aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSadposter <hannah+pleroma@coffee-and-dreams.uk>2019-04-05 16:51:45 +0100
committerHannah Ward <Hannah.ward9001@gmail.com>2019-04-05 17:02:07 +0100
commit9ca91cbb8764ef4f8fe5303705dd98984e4e90c0 (patch)
treef9aaa3397de39f5f68faff29cf09125c2126de32 /test
parentd35f6551c1e9b11dec81b622c9ed2d9cdd6ac389 (diff)
downloadpleroma-9ca91cbb8764ef4f8fe5303705dd98984e4e90c0.tar.gz
Change relationship direction of subscriptions
Diffstat (limited to 'test')
-rw-r--r--test/web/mastodon_api/account_view_test.exs2
-rw-r--r--test/web/mastodon_api/mastodon_api_controller_test.exs19
-rw-r--r--test/web/twitter_api/views/user_view_test.exs20
3 files changed, 25 insertions, 16 deletions
diff --git a/test/web/mastodon_api/account_view_test.exs b/test/web/mastodon_api/account_view_test.exs
index 6dc60afe9..48580ff1e 100644
--- a/test/web/mastodon_api/account_view_test.exs
+++ b/test/web/mastodon_api/account_view_test.exs
@@ -142,6 +142,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
blocking: true,
muting: false,
muting_notifications: false,
+ subscribing: false,
requested: false,
domain_blocking: false,
showing_reblogs: true,
@@ -198,6 +199,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
following: false,
followed_by: false,
blocking: true,
+ subscribing: false,
muting: false,
muting_notifications: false,
requested: false,
diff --git a/test/web/mastodon_api/mastodon_api_controller_test.exs b/test/web/mastodon_api/mastodon_api_controller_test.exs
index 6060cc97f..811a2dd7b 100644
--- a/test/web/mastodon_api/mastodon_api_controller_test.exs
+++ b/test/web/mastodon_api/mastodon_api_controller_test.exs
@@ -1555,6 +1555,25 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
assert %{"id" => _id, "muting" => false} = json_response(conn, 200)
end
+ test "subscribing / unsubscribing to a user", %{conn: conn} do
+ user = insert(:user)
+ subscription_target = insert(:user)
+
+ conn =
+ conn
+ |> assign(:user, user)
+ |> post("/api/v1/pleroma/accounts/#{subscription_target.id}/subscribe")
+
+ assert %{"id" => _id, "subscribing" => true} = json_response(conn, 200)
+
+ conn =
+ build_conn()
+ |> assign(:user, user)
+ |> post("/api/v1/pleroma/accounts/#{subscription_target.id}/unsubscribe")
+
+ assert %{"id" => _id, "subscribing" => false} = json_response(conn, 200)
+ end
+
test "getting a list of mutes", %{conn: conn} do
user = insert(:user)
other_user = insert(:user)
diff --git a/test/web/twitter_api/views/user_view_test.exs b/test/web/twitter_api/views/user_view_test.exs
index 69d9c5da5..0feaf4b64 100644
--- a/test/web/twitter_api/views/user_view_test.exs
+++ b/test/web/twitter_api/views/user_view_test.exs
@@ -105,8 +105,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
- "tags" => [],
- "subscribed" => false
+ "tags" => []
}
}
@@ -154,8 +153,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
- "tags" => [],
- "subscribed" => false
+ "tags" => []
}
}
@@ -204,22 +202,13 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
- "tags" => [],
- "subscribed" => false
+ "tags" => []
}
}
assert represented == UserView.render("show.json", %{user: follower, for: user})
end
- test "a user that you are subscribed to" do
- user = insert(:user)
- subscriber = insert(:user)
- {:ok, subscriber} = User.subscribe(subscriber, user)
- represented = UserView.render("show.json", %{user: user, for: subscriber})
- assert represented["pleroma"]["subscribed"] == true
- end
-
test "a user that is a moderator" do
user = insert(:user, %{info: %{is_moderator: true}})
represented = UserView.render("show.json", %{user: user, for: user})
@@ -299,8 +288,7 @@ defmodule Pleroma.Web.TwitterAPI.UserViewTest do
"fields" => [],
"pleroma" => %{
"confirmation_pending" => false,
- "tags" => [],
- "subscribed" => false
+ "tags" => []
}
}