X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Fmastodon_api%2Fcontrollers%2Fstatus_controller_test.exs;h=a647cd57fc3732c4be7773301ded9a7da8180daf;hb=8d4e0342e1b5ebbe486dc538e3c8fe81d53220e6;hp=ffff0ae9d6cde82eabe62b3401b6c14ce0a73215;hpb=80167e62dd7afaf761443d268d7c2306608ffea4;p=akkoma
diff --git a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
index ffff0ae9d..a647cd57f 100644
--- a/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/pleroma/web/mastodon_api/controllers/status_controller_test.exs
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2020 Pleroma Authors
+# Copyright © 2017-2021 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
@@ -7,7 +7,6 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
use Oban.Testing, repo: Pleroma.Repo
alias Pleroma.Activity
- alias Pleroma.Config
alias Pleroma.Conversation.Participation
alias Pleroma.Object
alias Pleroma.Repo
@@ -29,7 +28,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
setup do: oauth_access(["write:statuses"])
test "posting a status does not increment reblog_count when relaying", %{conn: conn} do
- Config.put([:instance, :federating], true)
+ clear_config([:instance, :federating], true)
Config.get([:instance, :allow_relay], true)
response =
@@ -151,8 +150,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
end
test "Get MRF reason when posting a status is rejected by one", %{conn: conn} do
- Config.put([:mrf_keyword, :reject], ["GNO"])
- Config.put([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy])
+ clear_config([:mrf_keyword, :reject], ["GNO"])
+ clear_config([:mrf, :policies], [Pleroma.Web.ActivityPub.MRF.KeywordPolicy])
assert %{"error" => "[KeywordPolicy] Matches with rejected keyword"} =
conn
@@ -954,6 +953,23 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
assert to_string(activity.id) == id
end
+
+ test "author can reblog own private status", %{conn: conn, user: user} do
+ {:ok, activity} = CommonAPI.post(user, %{status: "cofe", visibility: "private"})
+
+ conn =
+ conn
+ |> put_req_header("content-type", "application/json")
+ |> post("/api/v1/statuses/#{activity.id}/reblog")
+
+ assert %{
+ "reblog" => %{"id" => id, "reblogged" => true, "reblogs_count" => 1},
+ "reblogged" => true,
+ "visibility" => "private"
+ } = json_response_and_validate_schema(conn, 200)
+
+ assert to_string(activity.id) == id
+ end
end
describe "unreblogging" do
@@ -1187,7 +1203,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "cards" do
setup do
- Config.put([:rich_media, :enabled], true)
+ clear_config([:rich_media, :enabled], true)
oauth_access(["read:statuses"])
end