Merge branch 'develop' into issue/1276-2
This commit is contained in:
commit
8b97b6f5ba
54 changed files with 1566 additions and 239 deletions
|
|
@ -36,7 +36,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
|
||||
res_conn = get(conn, "/api/v1/conversations")
|
||||
|
||||
assert response = json_response(res_conn, 200)
|
||||
assert response = json_response_and_validate_schema(res_conn, 200)
|
||||
|
||||
assert [
|
||||
%{
|
||||
|
|
@ -91,18 +91,18 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
"visibility" => "direct"
|
||||
})
|
||||
|
||||
[conversation1, conversation2] =
|
||||
conn
|
||||
|> get("/api/v1/conversations", %{"recipients" => [user_two.id]})
|
||||
|> json_response(200)
|
||||
assert [conversation1, conversation2] =
|
||||
conn
|
||||
|> get("/api/v1/conversations?recipients[]=#{user_two.id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert conversation1["last_status"]["id"] == direct5.id
|
||||
assert conversation2["last_status"]["id"] == direct1.id
|
||||
|
||||
[conversation1] =
|
||||
conn
|
||||
|> get("/api/v1/conversations", %{"recipients" => [user_two.id, user_three.id]})
|
||||
|> json_response(200)
|
||||
|> get("/api/v1/conversations?recipients[]=#{user_two.id}&recipients[]=#{user_three.id}")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert conversation1["last_status"]["id"] == direct3.id
|
||||
end
|
||||
|
|
@ -126,7 +126,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
[%{"last_status" => res_last_status}] =
|
||||
conn
|
||||
|> get("/api/v1/conversations")
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert res_last_status["id"] == direct_reply.id
|
||||
end
|
||||
|
|
@ -154,12 +154,12 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
[%{"id" => direct_conversation_id, "unread" => true}] =
|
||||
user_two_conn
|
||||
|> get("/api/v1/conversations")
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
%{"unread" => false} =
|
||||
user_two_conn
|
||||
|> post("/api/v1/conversations/#{direct_conversation_id}/read")
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 0
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
|
|
@ -175,7 +175,7 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do
|
|||
[%{"unread" => true}] =
|
||||
conn
|
||||
|> get("/api/v1/conversations")
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert User.get_cached_by_id(user_one.id).unread_conversation_count == 1
|
||||
assert User.get_cached_by_id(user_two.id).unread_conversation_count == 0
|
||||
|
|
|
|||
|
|
@ -15,9 +15,12 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
|||
context: ["home"]
|
||||
}
|
||||
|
||||
conn = post(conn, "/api/v1/filters", %{"phrase" => filter.phrase, context: filter.context})
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/filters", %{"phrase" => filter.phrase, context: filter.context})
|
||||
|
||||
assert response = json_response(conn, 200)
|
||||
assert response = json_response_and_validate_schema(conn, 200)
|
||||
assert response["phrase"] == filter.phrase
|
||||
assert response["context"] == filter.context
|
||||
assert response["irreversible"] == false
|
||||
|
|
@ -48,12 +51,12 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
|||
response =
|
||||
conn
|
||||
|> get("/api/v1/filters")
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert response ==
|
||||
render_json(
|
||||
FilterView,
|
||||
"filters.json",
|
||||
"index.json",
|
||||
filters: [filter_two, filter_one]
|
||||
)
|
||||
end
|
||||
|
|
@ -72,7 +75,7 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
|||
|
||||
conn = get(conn, "/api/v1/filters/#{filter.filter_id}")
|
||||
|
||||
assert _response = json_response(conn, 200)
|
||||
assert response = json_response_and_validate_schema(conn, 200)
|
||||
end
|
||||
|
||||
test "update a filter" do
|
||||
|
|
@ -82,7 +85,8 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
|||
user_id: user.id,
|
||||
filter_id: 2,
|
||||
phrase: "knight",
|
||||
context: ["home"]
|
||||
context: ["home"],
|
||||
hide: true
|
||||
}
|
||||
|
||||
{:ok, _filter} = Pleroma.Filter.create(query)
|
||||
|
|
@ -93,14 +97,17 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
|||
}
|
||||
|
||||
conn =
|
||||
put(conn, "/api/v1/filters/#{query.filter_id}", %{
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> put("/api/v1/filters/#{query.filter_id}", %{
|
||||
phrase: new.phrase,
|
||||
context: new.context
|
||||
})
|
||||
|
||||
assert response = json_response(conn, 200)
|
||||
assert response = json_response_and_validate_schema(conn, 200)
|
||||
assert response["phrase"] == new.phrase
|
||||
assert response["context"] == new.context
|
||||
assert response["irreversible"] == true
|
||||
end
|
||||
|
||||
test "delete a filter" do
|
||||
|
|
@ -117,7 +124,6 @@ defmodule Pleroma.Web.MastodonAPI.FilterControllerTest do
|
|||
|
||||
conn = delete(conn, "/api/v1/filters/#{filter.filter_id}")
|
||||
|
||||
assert response = json_response(conn, 200)
|
||||
assert response == %{}
|
||||
assert json_response_and_validate_schema(conn, 200) == %{}
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
|||
|
||||
conn = get(conn, "/api/v1/follow_requests")
|
||||
|
||||
assert [relationship] = json_response(conn, 200)
|
||||
assert [relationship] = json_response_and_validate_schema(conn, 200)
|
||||
assert to_string(other_user.id) == relationship["id"]
|
||||
end
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
|||
|
||||
conn = post(conn, "/api/v1/follow_requests/#{other_user.id}/authorize")
|
||||
|
||||
assert relationship = json_response(conn, 200)
|
||||
assert relationship = json_response_and_validate_schema(conn, 200)
|
||||
assert to_string(other_user.id) == relationship["id"]
|
||||
|
||||
user = User.get_cached_by_id(user.id)
|
||||
|
|
@ -62,7 +62,7 @@ defmodule Pleroma.Web.MastodonAPI.FollowRequestControllerTest do
|
|||
|
||||
conn = post(conn, "/api/v1/follow_requests/#{other_user.id}/reject")
|
||||
|
||||
assert relationship = json_response(conn, 200)
|
||||
assert relationship = json_response_and_validate_schema(conn, 200)
|
||||
assert to_string(other_user.id) == relationship["id"]
|
||||
|
||||
user = User.get_cached_by_id(user.id)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
|
|||
|
||||
test "get instance information", %{conn: conn} do
|
||||
conn = get(conn, "/api/v1/instance")
|
||||
assert result = json_response(conn, 200)
|
||||
assert result = json_response_and_validate_schema(conn, 200)
|
||||
|
||||
email = Pleroma.Config.get([:instance, :email])
|
||||
# Note: not checking for "max_toot_chars" since it's optional
|
||||
|
|
@ -56,7 +56,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
|
|||
|
||||
conn = get(conn, "/api/v1/instance")
|
||||
|
||||
assert result = json_response(conn, 200)
|
||||
assert result = json_response_and_validate_schema(conn, 200)
|
||||
|
||||
stats = result["stats"]
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ defmodule Pleroma.Web.MastodonAPI.InstanceControllerTest do
|
|||
|
||||
conn = get(conn, "/api/v1/instance/peers")
|
||||
|
||||
assert result = json_response(conn, 200)
|
||||
assert result = json_response_and_validate_schema(conn, 200)
|
||||
|
||||
assert ["peer1.com", "peer2.com"] == Enum.sort(result)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,37 +12,44 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
test "creating a list" do
|
||||
%{conn: conn} = oauth_access(["write:lists"])
|
||||
|
||||
conn = post(conn, "/api/v1/lists", %{"title" => "cuties"})
|
||||
|
||||
assert %{"title" => title} = json_response(conn, 200)
|
||||
assert title == "cuties"
|
||||
assert %{"title" => "cuties"} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/lists", %{"title" => "cuties"})
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
end
|
||||
|
||||
test "renders error for invalid params" do
|
||||
%{conn: conn} = oauth_access(["write:lists"])
|
||||
|
||||
conn = post(conn, "/api/v1/lists", %{"title" => nil})
|
||||
conn =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/lists", %{"title" => nil})
|
||||
|
||||
assert %{"error" => "can't be blank"} == json_response(conn, :unprocessable_entity)
|
||||
assert %{"error" => "title - null value where string expected."} =
|
||||
json_response_and_validate_schema(conn, 400)
|
||||
end
|
||||
|
||||
test "listing a user's lists" do
|
||||
%{conn: conn} = oauth_access(["read:lists", "write:lists"])
|
||||
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/lists", %{"title" => "cuties"})
|
||||
|> json_response(:ok)
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/lists", %{"title" => "cofe"})
|
||||
|> json_response(:ok)
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
|
||||
conn = get(conn, "/api/v1/lists")
|
||||
|
||||
assert [
|
||||
%{"id" => _, "title" => "cofe"},
|
||||
%{"id" => _, "title" => "cuties"}
|
||||
] = json_response(conn, :ok)
|
||||
] = json_response_and_validate_schema(conn, :ok)
|
||||
end
|
||||
|
||||
test "adding users to a list" do
|
||||
|
|
@ -50,9 +57,12 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
other_user = insert(:user)
|
||||
{:ok, list} = Pleroma.List.create("name", user)
|
||||
|
||||
conn = post(conn, "/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]})
|
||||
assert %{} ==
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]})
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
|
||||
assert %{} == json_response(conn, 200)
|
||||
%Pleroma.List{following: following} = Pleroma.List.get(list.id, user)
|
||||
assert following == [other_user.follower_address]
|
||||
end
|
||||
|
|
@ -65,9 +75,12 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
{:ok, list} = Pleroma.List.follow(list, other_user)
|
||||
{:ok, list} = Pleroma.List.follow(list, third_user)
|
||||
|
||||
conn = delete(conn, "/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]})
|
||||
assert %{} ==
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> delete("/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]})
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
|
||||
assert %{} == json_response(conn, 200)
|
||||
%Pleroma.List{following: following} = Pleroma.List.get(list.id, user)
|
||||
assert following == [third_user.follower_address]
|
||||
end
|
||||
|
|
@ -83,7 +96,7 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
|> assign(:user, user)
|
||||
|> get("/api/v1/lists/#{list.id}/accounts", %{"account_ids" => [other_user.id]})
|
||||
|
||||
assert [%{"id" => id}] = json_response(conn, 200)
|
||||
assert [%{"id" => id}] = json_response_and_validate_schema(conn, 200)
|
||||
assert id == to_string(other_user.id)
|
||||
end
|
||||
|
||||
|
|
@ -96,7 +109,7 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
|> assign(:user, user)
|
||||
|> get("/api/v1/lists/#{list.id}")
|
||||
|
||||
assert %{"id" => id} = json_response(conn, 200)
|
||||
assert %{"id" => id} = json_response_and_validate_schema(conn, 200)
|
||||
assert id == to_string(list.id)
|
||||
end
|
||||
|
||||
|
|
@ -105,17 +118,18 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
|
||||
conn = get(conn, "/api/v1/lists/666")
|
||||
|
||||
assert %{"error" => "List not found"} = json_response(conn, :not_found)
|
||||
assert %{"error" => "List not found"} = json_response_and_validate_schema(conn, :not_found)
|
||||
end
|
||||
|
||||
test "renaming a list" do
|
||||
%{user: user, conn: conn} = oauth_access(["write:lists"])
|
||||
{:ok, list} = Pleroma.List.create("name", user)
|
||||
|
||||
conn = put(conn, "/api/v1/lists/#{list.id}", %{"title" => "newname"})
|
||||
|
||||
assert %{"title" => name} = json_response(conn, 200)
|
||||
assert name == "newname"
|
||||
assert %{"title" => "newname"} =
|
||||
conn
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> put("/api/v1/lists/#{list.id}", %{"title" => "newname"})
|
||||
|> json_response_and_validate_schema(:ok)
|
||||
end
|
||||
|
||||
test "validates title when renaming a list" do
|
||||
|
|
@ -125,9 +139,11 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
conn =
|
||||
conn
|
||||
|> assign(:user, user)
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> put("/api/v1/lists/#{list.id}", %{"title" => " "})
|
||||
|
||||
assert %{"error" => "can't be blank"} == json_response(conn, :unprocessable_entity)
|
||||
assert %{"error" => "can't be blank"} ==
|
||||
json_response_and_validate_schema(conn, :unprocessable_entity)
|
||||
end
|
||||
|
||||
test "deleting a list" do
|
||||
|
|
@ -136,7 +152,7 @@ defmodule Pleroma.Web.MastodonAPI.ListControllerTest do
|
|||
|
||||
conn = delete(conn, "/api/v1/lists/#{list.id}")
|
||||
|
||||
assert %{} = json_response(conn, 200)
|
||||
assert %{} = json_response_and_validate_schema(conn, 200)
|
||||
assert is_nil(Repo.get(Pleroma.List, list.id))
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|
|||
conn
|
||||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|> get("/api/v1/markers", %{timeline: ["notifications"]})
|
||||
|> json_response(200)
|
||||
|> get("/api/v1/markers?timeline[]=notifications")
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert response == %{
|
||||
"notifications" => %{
|
||||
|
|
@ -47,7 +47,7 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|
|||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|> get("/api/v1/markers", %{timeline: ["notifications"]})
|
||||
|> json_response(403)
|
||||
|> json_response_and_validate_schema(403)
|
||||
|
||||
assert response == %{"error" => "Insufficient permissions: read:statuses."}
|
||||
end
|
||||
|
|
@ -62,11 +62,12 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|
|||
conn
|
||||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/markers", %{
|
||||
home: %{last_read_id: "777"},
|
||||
notifications: %{"last_read_id" => "69420"}
|
||||
})
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert %{
|
||||
"notifications" => %{
|
||||
|
|
@ -92,11 +93,12 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|
|||
conn
|
||||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/markers", %{
|
||||
home: %{last_read_id: "777"},
|
||||
notifications: %{"last_read_id" => "69888"}
|
||||
})
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert response == %{
|
||||
"notifications" => %{
|
||||
|
|
@ -116,11 +118,12 @@ defmodule Pleroma.Web.MastodonAPI.MarkerControllerTest do
|
|||
conn
|
||||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|> post("/api/v1/markers", %{
|
||||
home: %{last_read_id: "777"},
|
||||
notifications: %{"last_read_id" => "69420"}
|
||||
})
|
||||
|> json_response(403)
|
||||
|> json_response_and_validate_schema(403)
|
||||
|
||||
assert response == %{"error" => "Insufficient permissions: write:statuses."}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
use Pleroma.Web.ConnCase
|
||||
|
||||
import Pleroma.Factory
|
||||
|
||||
alias Pleroma.Web.Push
|
||||
alias Pleroma.Web.Push.Subscription
|
||||
|
||||
|
|
@ -27,6 +28,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
build_conn()
|
||||
|> assign(:user, user)
|
||||
|> assign(:token, token)
|
||||
|> put_req_header("content-type", "application/json")
|
||||
|
||||
%{conn: conn, user: user, token: token}
|
||||
end
|
||||
|
|
@ -47,8 +49,8 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
test "returns error when push disabled ", %{conn: conn} do
|
||||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> post("/api/v1/push/subscription", %{})
|
||||
|> json_response(403)
|
||||
|> post("/api/v1/push/subscription", %{subscription: @sub})
|
||||
|> json_response_and_validate_schema(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -59,7 +61,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
"data" => %{"alerts" => %{"mention" => true, "test" => true}},
|
||||
"subscription" => @sub
|
||||
})
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
[subscription] = Pleroma.Repo.all(Subscription)
|
||||
|
||||
|
|
@ -77,7 +79,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> get("/api/v1/push/subscription", %{})
|
||||
|> json_response(403)
|
||||
|> json_response_and_validate_schema(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -85,9 +87,9 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
res =
|
||||
conn
|
||||
|> get("/api/v1/push/subscription", %{})
|
||||
|> json_response(404)
|
||||
|> json_response_and_validate_schema(404)
|
||||
|
||||
assert "Not found" == res
|
||||
assert %{"error" => "Record not found"} == res
|
||||
end
|
||||
|
||||
test "returns a user subsciption", %{conn: conn, user: user, token: token} do
|
||||
|
|
@ -101,7 +103,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
res =
|
||||
conn
|
||||
|> get("/api/v1/push/subscription", %{})
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
expect = %{
|
||||
"alerts" => %{"mention" => true},
|
||||
|
|
@ -130,7 +132,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> put("/api/v1/push/subscription", %{data: %{"alerts" => %{"mention" => false}}})
|
||||
|> json_response(403)
|
||||
|> json_response_and_validate_schema(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -140,7 +142,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
|> put("/api/v1/push/subscription", %{
|
||||
data: %{"alerts" => %{"mention" => false, "follow" => true}}
|
||||
})
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
expect = %{
|
||||
"alerts" => %{"follow" => true, "mention" => false},
|
||||
|
|
@ -158,7 +160,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
assert_error_when_disable_push do
|
||||
conn
|
||||
|> delete("/api/v1/push/subscription", %{})
|
||||
|> json_response(403)
|
||||
|> json_response_and_validate_schema(403)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -166,9 +168,9 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
res =
|
||||
conn
|
||||
|> delete("/api/v1/push/subscription", %{})
|
||||
|> json_response(404)
|
||||
|> json_response_and_validate_schema(404)
|
||||
|
||||
assert "Not found" == res
|
||||
assert %{"error" => "Record not found"} == res
|
||||
end
|
||||
|
||||
test "returns empty result and delete user subsciption", %{
|
||||
|
|
@ -186,7 +188,7 @@ defmodule Pleroma.Web.MastodonAPI.SubscriptionControllerTest do
|
|||
res =
|
||||
conn
|
||||
|> delete("/api/v1/push/subscription", %{})
|
||||
|> json_response(200)
|
||||
|> json_response_and_validate_schema(200)
|
||||
|
||||
assert %{} == res
|
||||
refute Pleroma.Repo.get(Subscription, subscription.id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue