forked from AkkomaGang/akkoma
add tests for unauthed reqs to liked/reblogged_by
This commit is contained in:
parent
eacf61d823
commit
fd1fa5a2ec
1 changed files with 28 additions and 0 deletions
|
@ -3786,6 +3786,20 @@ test "does not return users who have favorited the status but are blocked", %{
|
||||||
|
|
||||||
assert Enum.empty?(response)
|
assert Enum.empty?(response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
|
||||||
|
other_user = insert(:user)
|
||||||
|
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> assign(:user, nil)
|
||||||
|
|> get("/api/v1/#{activity.id}/favourited_by")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
[%{"id" => id}] = response
|
||||||
|
assert id == other_user.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "GET /api/v1/statuses/:id/reblogged_by" do
|
describe "GET /api/v1/statuses/:id/reblogged_by" do
|
||||||
|
@ -3843,6 +3857,20 @@ test "does not return users who have reblogged the status but are blocked", %{
|
||||||
|
|
||||||
assert Enum.empty?(response)
|
assert Enum.empty?(response)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
|
||||||
|
other_user = insert(:user)
|
||||||
|
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> assign(:user, nil)
|
||||||
|
|> get("/api/v1/#{activity.id}/reblogged_by")
|
||||||
|
|> json_response(:ok)
|
||||||
|
|
||||||
|
[%{"id" => id}] = response
|
||||||
|
assert id == other_user.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "POST /auth/password, with valid parameters" do
|
describe "POST /auth/password, with valid parameters" do
|
||||||
|
|
Loading…
Reference in a new issue