diff options
| author | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-27 15:20:47 +0300 | 
|---|---|---|
| committer | Maksim Pechnikov <parallel588@gmail.com> | 2020-01-27 15:20:47 +0300 | 
| commit | e442ea5722404ca551135b6f4767c016952bbda3 (patch) | |
| tree | 91bb371d96fbc8b46d59c378f6dd690ba30f3da3 /test/web/mastodon_api/controllers/follow_request_controller_test.exs | |
| parent | 6fbafb1cdcba3dc2a7e8b9718e295c9811a726d9 (diff) | |
| parent | 0b582d415ba5215495047ddae1cb4e4fc1e016e6 (diff) | |
| download | pleroma-e442ea5722404ca551135b6f4767c016952bbda3.tar.gz pleroma-e442ea5722404ca551135b6f4767c016952bbda3.zip  | |
Merge branch 'develop' into issue/1276
Diffstat (limited to 'test/web/mastodon_api/controllers/follow_request_controller_test.exs')
| -rw-r--r-- | test/web/mastodon_api/controllers/follow_request_controller_test.exs | 28 | 
1 files changed, 11 insertions, 17 deletions
diff --git a/test/web/mastodon_api/controllers/follow_request_controller_test.exs b/test/web/mastodon_api/controllers/follow_request_controller_test.exs index 288cd9029..6e4a76501 100644 --- a/test/web/mastodon_api/controllers/follow_request_controller_test.exs +++ b/test/web/mastodon_api/controllers/follow_request_controller_test.exs @@ -11,8 +11,13 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do    import Pleroma.Factory    describe "locked accounts" do -    test "/api/v1/follow_requests works" do +    setup do        user = insert(:user, locked: true) +      %{conn: conn} = oauth_access(["follow"], user: user) +      %{user: user, conn: conn} +    end + +    test "/api/v1/follow_requests works", %{user: user, conn: conn} do        other_user = insert(:user)        {:ok, _activity} = ActivityPub.follow(other_user, user) @@ -20,17 +25,13 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do        assert User.following?(other_user, user) == false -      conn = -        build_conn() -        |> assign(:user, user) -        |> get("/api/v1/follow_requests") +      conn = get(conn, "/api/v1/follow_requests")        assert [relationship] = json_response(conn, 200)        assert to_string(other_user.id) == relationship["id"]      end -    test "/api/v1/follow_requests/:id/authorize works" do -      user = insert(:user, locked: true) +    test "/api/v1/follow_requests/:id/authorize works", %{user: user, conn: conn} do        other_user = insert(:user)        {:ok, _activity} = ActivityPub.follow(other_user, user) @@ -41,10 +42,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do        assert User.following?(other_user, user) == false -      conn = -        build_conn() -        |> assign(:user, user) -        |> post("/api/v1/follow_requests/#{other_user.id}/authorize") +      conn = post(conn, "/api/v1/follow_requests/#{other_user.id}/authorize")        assert relationship = json_response(conn, 200)        assert to_string(other_user.id) == relationship["id"] @@ -55,18 +53,14 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do        assert User.following?(other_user, user) == true      end -    test "/api/v1/follow_requests/:id/reject works" do -      user = insert(:user, locked: true) +    test "/api/v1/follow_requests/:id/reject works", %{user: user, conn: conn} do        other_user = insert(:user)        {:ok, _activity} = ActivityPub.follow(other_user, user)        user = User.get_cached_by_id(user.id) -      conn = -        build_conn() -        |> assign(:user, user) -        |> post("/api/v1/follow_requests/#{other_user.id}/reject") +      conn = post(conn, "/api/v1/follow_requests/#{other_user.id}/reject")        assert relationship = json_response(conn, 200)        assert to_string(other_user.id) == relationship["id"]  | 
