summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/status_controller_test.exs
diff options
context:
space:
mode:
authorIvan Tashkinov <ivantashkinov@gmail.com>2020-03-20 18:33:00 +0300
committerIvan Tashkinov <ivantashkinov@gmail.com>2020-03-20 18:33:00 +0300
commit1c05f539aaea32fe993e5299e656aa44c322e8de (patch)
treedb7724289ac074e0b70b7405d9080e50b8a8175d /test/web/mastodon_api/controllers/status_controller_test.exs
parent0e27c274f4f68f3385753a2482d881bae7c35a06 (diff)
downloadpleroma-1c05f539aaea32fe993e5299e656aa44c322e8de.tar.gz
pleroma-1c05f539aaea32fe993e5299e656aa44c322e8de.zip
Improved in-test `clear_config/n` applicability (setup / setup_all / in-test usage).
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/status_controller_test.exs40
1 files changed, 12 insertions, 28 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs
index beb547780..d59974d50 100644
--- a/test/web/mastodon_api/controllers/status_controller_test.exs
+++ b/test/web/mastodon_api/controllers/status_controller_test.exs
@@ -19,9 +19,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
import Pleroma.Factory
- clear_config([:instance, :federating])
- clear_config([:instance, :allow_relay])
- clear_config([:rich_media, :enabled])
+ setup do: clear_config([:instance, :federating])
+ setup do: clear_config([:instance, :allow_relay])
+ setup do: clear_config([:rich_media, :enabled])
describe "posting statuses" do
setup do: oauth_access(["write:statuses"])
@@ -485,13 +485,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "status with restrict unauthenticated activities for local and remote" do
setup do: local_and_remote_activities()
- clear_config([:restrict_unauthenticated, :activities, :local]) do
- Config.put([:restrict_unauthenticated, :activities, :local], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :local], true)
- clear_config([:restrict_unauthenticated, :activities, :remote]) do
- Config.put([:restrict_unauthenticated, :activities, :remote], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :remote], true)
test "if user is unauthenticated", %{conn: conn, local: local, remote: remote} do
res_conn = get(conn, "/api/v1/statuses/#{local.id}")
@@ -520,9 +516,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "status with restrict unauthenticated activities for local" do
setup do: local_and_remote_activities()
- clear_config([:restrict_unauthenticated, :activities, :local]) do
- Config.put([:restrict_unauthenticated, :activities, :local], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :local], true)
test "if user is unauthenticated", %{conn: conn, local: local, remote: remote} do
res_conn = get(conn, "/api/v1/statuses/#{local.id}")
@@ -548,9 +542,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "status with restrict unauthenticated activities for remote" do
setup do: local_and_remote_activities()
- clear_config([:restrict_unauthenticated, :activities, :remote]) do
- Config.put([:restrict_unauthenticated, :activities, :remote], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :remote], true)
test "if user is unauthenticated", %{conn: conn, local: local, remote: remote} do
res_conn = get(conn, "/api/v1/statuses/#{local.id}")
@@ -614,13 +606,9 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "getting statuses by ids with restricted unauthenticated for local and remote" do
setup do: local_and_remote_activities()
- clear_config([:restrict_unauthenticated, :activities, :local]) do
- Config.put([:restrict_unauthenticated, :activities, :local], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :local], true)
- clear_config([:restrict_unauthenticated, :activities, :remote]) do
- Config.put([:restrict_unauthenticated, :activities, :remote], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :remote], true)
test "if user is unauthenticated", %{conn: conn, local: local, remote: remote} do
res_conn = get(conn, "/api/v1/statuses", %{ids: [local.id, remote.id]})
@@ -640,9 +628,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "getting statuses by ids with restricted unauthenticated for local" do
setup do: local_and_remote_activities()
- clear_config([:restrict_unauthenticated, :activities, :local]) do
- Config.put([:restrict_unauthenticated, :activities, :local], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :local], true)
test "if user is unauthenticated", %{conn: conn, local: local, remote: remote} do
res_conn = get(conn, "/api/v1/statuses", %{ids: [local.id, remote.id]})
@@ -663,9 +649,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
describe "getting statuses by ids with restricted unauthenticated for remote" do
setup do: local_and_remote_activities()
- clear_config([:restrict_unauthenticated, :activities, :remote]) do
- Config.put([:restrict_unauthenticated, :activities, :remote], true)
- end
+ setup do: clear_config([:restrict_unauthenticated, :activities, :remote], true)
test "if user is unauthenticated", %{conn: conn, local: local, remote: remote} do
res_conn = get(conn, "/api/v1/statuses", %{ids: [local.id, remote.id]})
@@ -908,7 +892,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
%{activity: activity}
end
- clear_config([:instance, :max_pinned_statuses], 1)
+ setup do: clear_config([:instance, :max_pinned_statuses], 1)
test "pin status", %{conn: conn, user: user, activity: activity} do
id_str = to_string(activity.id)