summaryrefslogtreecommitdiff
path: root/test/web/mastodon_api/controllers/suggestion_controller_test.exs
diff options
context:
space:
mode:
authorMaksim Pechnikov <parallel588@gmail.com>2020-01-14 16:26:56 +0300
committerMaksim Pechnikov <parallel588@gmail.com>2020-01-14 21:29:14 +0300
commitc9f45edeac2cc3ed262bb4b30dc7e1120c6fa047 (patch)
tree3ba35681409d9c5dd9ca4d355ff39d4dd67448d4 /test/web/mastodon_api/controllers/suggestion_controller_test.exs
parent969769730e0b7578ddc6a5cd02f9b24eff5902a0 (diff)
parent12b28c8925c2c55e0d7bb66ff3320532a1aade3b (diff)
downloadpleroma-c9f45edeac2cc3ed262bb4b30dc7e1120c6fa047.tar.gz
pleroma-c9f45edeac2cc3ed262bb4b30dc7e1120c6fa047.zip
Merge branch 'develop' into feature/tag_feed
Diffstat (limited to 'test/web/mastodon_api/controllers/suggestion_controller_test.exs')
-rw-r--r--test/web/mastodon_api/controllers/suggestion_controller_test.exs16
1 files changed, 7 insertions, 9 deletions
diff --git a/test/web/mastodon_api/controllers/suggestion_controller_test.exs b/test/web/mastodon_api/controllers/suggestion_controller_test.exs
index 78620a873..c4118a576 100644
--- a/test/web/mastodon_api/controllers/suggestion_controller_test.exs
+++ b/test/web/mastodon_api/controllers/suggestion_controller_test.exs
@@ -11,8 +11,9 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
import Pleroma.Factory
import Tesla.Mock
- setup do
- user = insert(:user)
+ setup do: oauth_access(["read"])
+
+ setup %{user: user} do
other_user = insert(:user)
host = Config.get([Pleroma.Web.Endpoint, :url, :host])
url500 = "http://test500?#{host}&#{user.nickname}"
@@ -32,31 +33,29 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
}
end)
- [user: user, other_user: other_user]
+ [other_user: other_user]
end
clear_config(:suggestions)
- test "returns empty result when suggestions disabled", %{conn: conn, user: user} do
+ test "returns empty result when suggestions disabled", %{conn: conn} do
Config.put([:suggestions, :enabled], false)
res =
conn
- |> assign(:user, user)
|> get("/api/v1/suggestions")
|> json_response(200)
assert res == []
end
- test "returns error", %{conn: conn, user: user} do
+ test "returns error", %{conn: conn} do
Config.put([:suggestions, :enabled], true)
Config.put([:suggestions, :third_party_engine], "http://test500?{{host}}&{{user}}")
assert capture_log(fn ->
res =
conn
- |> assign(:user, user)
|> get("/api/v1/suggestions")
|> json_response(500)
@@ -64,13 +63,12 @@ defmodule Pleroma.Web.MastodonAPI.SuggestionControllerTest do
end) =~ "Could not retrieve suggestions"
end
- test "returns suggestions", %{conn: conn, user: user, other_user: other_user} do
+ test "returns suggestions", %{conn: conn, other_user: other_user} do
Config.put([:suggestions, :enabled], true)
Config.put([:suggestions, :third_party_engine], "http://test200?{{host}}&{{user}}")
res =
conn
- |> assign(:user, user)
|> get("/api/v1/suggestions")
|> json_response(200)