summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/status_controller_test.exs
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-03-20 16:54:55 +0000
committerlain <lain@soykaf.club>2020-03-20 16:54:55 +0000
commitd23e81903dfe5032bb20b92bcc7dfb47434ba669 (patch)
treedb7724289ac074e0b70b7405d9080e50b8a8175d /test/web/mastodon_api/controllers/status_controller_test.exs
parent5efa5b0c4a08c2bf73d6926ee7c418e31a04195c (diff)
parent1c05f539aaea32fe993e5299e656aa44c322e8de (diff)
downloadpleroma-d23e81903dfe5032bb20b92bcc7dfb47434ba669.tar.gz
pleroma-d23e81903dfe5032bb20b92bcc7dfb47434ba669.zip
Merge branch 'clear-config-test-improvements' into 'develop'
Improved in-test config management See merge request pleroma/pleroma!2312
Diffstat (limited to 'test/web/mastodon_api/controllers/status_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/status_controller_test.exs42
1 files changed, 12 insertions, 30 deletions
diff --git a/test/web/mastodon_api/controllers/status_controller_test.exs b/test/web/mastodon_api/controllers/status_controller_test.exs
index 81513a429..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,9 +892,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusControllerTest do
%{activity: activity}
end
- clear_config([:instance, :max_pinned_statuses]) do
- Config.put([:instance, :max_pinned_statuses], 1)
- end
+ 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)