Add specs for AccountController.mutes, AccountController.blocks, AccountController.mutes, AccountController.endorsements
This commit is contained in:
parent
ab185d3ea4
commit
7e0b42d99f
3 changed files with 41 additions and 25 deletions
|
@ -321,7 +321,42 @@ def follows_operation do
|
|||
}
|
||||
end
|
||||
|
||||
def mutes_operation, do: :ok
|
||||
def blocks_operation, do: :ok
|
||||
def endorsements_operation, do: :ok
|
||||
def mutes_operation do
|
||||
%Operation{
|
||||
tags: ["accounts"],
|
||||
summary: "Muted accounts",
|
||||
operationId: "AccountController.mutes",
|
||||
description: "Accounts the user has muted.",
|
||||
security: [%{"oAuth" => ["follow", "read:mutes"]}],
|
||||
responses: %{
|
||||
200 => Operation.response("Accounts", "application/json", AccountsResponse)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def blocks_operation do
|
||||
%Operation{
|
||||
tags: ["accounts"],
|
||||
summary: "Blocked users",
|
||||
operationId: "AccountController.blocks",
|
||||
description: "View your blocks. See also accounts/:id/{block,unblock}",
|
||||
security: [%{"oAuth" => ["read:blocks"]}],
|
||||
responses: %{
|
||||
200 => Operation.response("Accounts", "application/json", AccountsResponse)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def endorsements_operation do
|
||||
%Operation{
|
||||
tags: ["accounts"],
|
||||
summary: "Endorsements",
|
||||
operationId: "AccountController.endorsements",
|
||||
description: "Not implemented",
|
||||
security: [%{"oAuth" => ["read:accounts"]}],
|
||||
responses: %{
|
||||
200 => Operation.response("Empry array", "application/json", %Schema{type: :array})
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,28 +80,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountController do
|
|||
plug(RateLimiter, [name: :app_account_creation] when action == :create)
|
||||
plug(:assign_account_by_id when action in @needs_account)
|
||||
|
||||
plug(
|
||||
OpenApiSpex.Plug.CastAndValidate,
|
||||
[render_error: Pleroma.Web.ApiSpec.RenderError]
|
||||
when action in [
|
||||
:create,
|
||||
:verify_credentials,
|
||||
:update_credentials,
|
||||
:relationships,
|
||||
:show,
|
||||
:statuses,
|
||||
:followers,
|
||||
:following,
|
||||
:lists,
|
||||
:follow,
|
||||
:unfollow,
|
||||
:mute,
|
||||
:unmute,
|
||||
:block,
|
||||
:unblock,
|
||||
:follows
|
||||
]
|
||||
)
|
||||
plug(OpenApiSpex.Plug.CastAndValidate, render_error: Pleroma.Web.ApiSpec.RenderError)
|
||||
|
||||
action_fallback(Pleroma.Web.MastodonAPI.FallbackController)
|
||||
|
||||
|
|
|
@ -1155,6 +1155,7 @@ test "getting a list of mutes" do
|
|||
|
||||
other_user_id = to_string(other_user.id)
|
||||
assert [%{"id" => ^other_user_id}] = json_response(conn, 200)
|
||||
assert_schema(json_response(conn, 200), "AccountsResponse", ApiSpec.spec())
|
||||
end
|
||||
|
||||
test "getting a list of blocks" do
|
||||
|
@ -1170,5 +1171,6 @@ test "getting a list of blocks" do
|
|||
|
||||
other_user_id = to_string(other_user.id)
|
||||
assert [%{"id" => ^other_user_id}] = json_response(conn, 200)
|
||||
assert_schema(json_response(conn, 200), "AccountsResponse", ApiSpec.spec())
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue