Add test for mastodon muting endpoints
This commit is contained in:
parent
da64ea4a55
commit
ad2cf4fd86
|
@ -1206,6 +1206,42 @@ test "following / unfollowing a user", %{conn: conn} do
|
|||
assert id == to_string(other_user.id)
|
||||
end
|
||||
|
||||
test "muting / unmuting a user", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/accounts/#{other_user.id}/mute")
|
||||
|
||||
assert %{"id" => _id, "muting" => true} = json_response(conn, 200)
|
||||
|
||||
user = Repo.get(User, user.id)
|
||||
|
||||
conn =
|
||||
build_conn()
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/accounts/#{other_user.id}/unmute")
|
||||
|
||||
assert %{"id" => _id, "muting" => false} = json_response(conn, 200)
|
||||
end
|
||||
|
||||
test "getting a list of mutes", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
{:ok, user} = User.mute(user, other_user)
|
||||
|
||||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> get("/api/v1/mutes")
|
||||
|
||||
other_user_id = to_string(other_user.id)
|
||||
assert [%{"id" => ^other_user_id}] = json_response(conn, 200)
|
||||
end
|
||||
|
||||
test "blocking / unblocking a user", %{conn: conn} do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
@ -1282,26 +1318,10 @@ test "getting a list of domain blocks", %{conn: conn} do
|
|||
assert "even.worse.site" in domain_blocks
|
||||
end
|
||||
|
||||
test "unimplemented mute endpoints" do
|
||||
user = insert(:user)
|
||||
other_user = insert(:user)
|
||||
|
||||
["mute", "unmute"]
|
||||
|> Enum.each(fn endpoint ->
|
||||
conn =
|
||||
build_conn()
|
||||
|> assign(:user, user)
|
||||
|> post("/api/v1/accounts/#{other_user.id}/#{endpoint}")
|
||||
|
||||
assert %{"id" => id} = json_response(conn, 200)
|
||||
assert id == to_string(other_user.id)
|
||||
end)
|
||||
end
|
||||
|
||||
test "unimplemented mutes, follow_requests, blocks, domain blocks" do
|
||||
test "unimplemented follow_requests, blocks, domain blocks" do
|
||||
user = insert(:user)
|
||||
|
||||
["blocks", "domain_blocks", "mutes", "follow_requests"]
|
||||
["blocks", "domain_blocks", "follow_requests"]
|
||||
|> Enum.each(fn endpoint ->
|
||||
conn =
|
||||
build_conn()
|
||||
|
|
Loading…
Reference in New Issue