projects
/
akkoma
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'develop' into gun
[akkoma]
/
test
/
web
/
mastodon_api
/
controllers
/
follow_request_controller_test.exs
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 288cd90298c97ed3c313dbd2be750896afeebb4b..dd848821a606b11c5976eb62dcc5ff3824843713 100644
(file)
--- a/
test/web/mastodon_api/controllers/follow_request_controller_test.exs
+++ b/
test/web/mastodon_api/controllers/follow_request_controller_test.exs
@@
-1,5
+1,5
@@
# Pleroma: A lightweight social networking server
# Pleroma: A lightweight social networking server
-# Copyright © 2017-20
19
Pleroma Authors <https://pleroma.social/>
+# Copyright © 2017-20
20
Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
@@
-11,8
+11,13
@@
defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
import Pleroma.Factory
describe "locked accounts" do
import Pleroma.Factory
describe "locked accounts" do
-
test "/api/v1/follow_requests works"
do
+
setup
do
user = insert(:user, locked: true)
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)
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
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
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)
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
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"]
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
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)
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"]
assert relationship = json_response(conn, 200)
assert to_string(other_user.id) == relationship["id"]