X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;f=test%2Fweb%2Ftwitter_api%2Fremote_follow_controller_test.exs;h=5ff8694a8d40d518cb12476331f7eaa95d5c5182;hb=142bf0957c64f76b9b511200544b1ccbcef5ba16;hp=4449493759540276d074c1b413ac1c0dc5e1465c;hpb=6cc5341d26426f98a53a6e46787f1457f974f321;p=akkoma
diff --git a/test/web/twitter_api/remote_follow_controller_test.exs b/test/web/twitter_api/remote_follow_controller_test.exs
index 444949375..5ff8694a8 100644
--- a/test/web/twitter_api/remote_follow_controller_test.exs
+++ b/test/web/twitter_api/remote_follow_controller_test.exs
@@ -1,12 +1,14 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2019 Pleroma Authors
+# Copyright © 2017-2020 Pleroma Authors
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
use Pleroma.Web.ConnCase
+ alias Pleroma.Config
alias Pleroma.User
alias Pleroma.Web.CommonAPI
+
import ExUnit.CaptureLog
import Pleroma.Factory
@@ -15,9 +17,10 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
:ok
end
- clear_config([:instance])
- clear_config([:frontend_configurations, :pleroma_fe])
- clear_config([:user, :deny_follow_blocked])
+ setup_all do: clear_config([:instance, :federating], true)
+ setup do: clear_config([:instance])
+ setup do: clear_config([:frontend_configurations, :pleroma_fe])
+ setup do: clear_config([:user, :deny_follow_blocked])
describe "GET /ostatus_subscribe - remote_follow/2" do
test "adds status to pleroma instance if the `acct` is a status", %{conn: conn} do
@@ -92,15 +95,13 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
user = insert(:user)
user2 = insert(:user)
- response =
+ conn =
conn
|> assign(:user, user)
|> assign(:token, insert(:oauth_token, user: user, scopes: ["write:follows"]))
|> post(remote_follow_path(conn, :do_follow), %{"user" => %{"id" => user2.id}})
- |> response(200)
- assert response =~ "Account followed!"
- assert user2.follower_address in User.following(user)
+ assert redirected_to(conn) == "/users/#{user2.id}"
end
test "returns error when user is deactivated", %{conn: conn} do
@@ -149,14 +150,13 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
user2 = insert(:user)
{:ok, _, _, _} = CommonAPI.follow(user, user2)
- response =
+ conn =
conn
|> assign(:user, refresh_record(user))
|> assign(:token, insert(:oauth_token, user: user, scopes: ["write:follows"]))
|> post(remote_follow_path(conn, :do_follow), %{"user" => %{"id" => user2.id}})
- |> response(200)
- assert response =~ "Account followed!"
+ assert redirected_to(conn) == "/users/#{user2.id}"
end
end
@@ -165,14 +165,13 @@ defmodule Pleroma.Web.TwitterAPI.RemoteFollowControllerTest do
user = insert(:user)
user2 = insert(:user)
- response =
+ conn =
conn
|> post(remote_follow_path(conn, :do_follow), %{
"authorization" => %{"name" => user.nickname, "password" => "test", "id" => user2.id}
})
- |> response(200)
- assert response =~ "Account followed!"
+ assert redirected_to(conn) == "/users/#{user2.id}"
assert user2.follower_address in User.following(user)
end