Fix api spec and tests
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
bda8589f16
commit
47271b50a1
7 changed files with 25 additions and 20 deletions
|
@ -96,7 +96,16 @@ def spec(opts \\ []) do
|
||||||
"Report managment",
|
"Report managment",
|
||||||
"Status administration",
|
"Status administration",
|
||||||
"User administration",
|
"User administration",
|
||||||
"Announcement management"
|
"Announcement management",
|
||||||
|
"Instance rule managment",
|
||||||
|
"Webhooks"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
%{
|
||||||
|
"name" => "Administration (MastoAPI)",
|
||||||
|
"tags" => [
|
||||||
|
"User administration",
|
||||||
|
"Report methods"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{"name" => "Applications", "tags" => ["Applications", "Push subscriptions"]},
|
%{"name" => "Applications", "tags" => ["Applications", "Push subscriptions"]},
|
||||||
|
@ -129,7 +138,8 @@ def spec(opts \\ []) do
|
||||||
"Scheduled statuses",
|
"Scheduled statuses",
|
||||||
"Search",
|
"Search",
|
||||||
"Status actions",
|
"Status actions",
|
||||||
"Media attachments"
|
"Media attachments",
|
||||||
|
"Event actions"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
|
|
|
@ -224,7 +224,7 @@ def post_chat_message_operation do
|
||||||
|
|
||||||
def delete_operation do
|
def delete_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["chat"],
|
tags: ["Chats"],
|
||||||
summary: "delete",
|
summary: "delete",
|
||||||
operationId: "ChatController.delete",
|
operationId: "ChatController.delete",
|
||||||
parameters: [
|
parameters: [
|
||||||
|
|
|
@ -25,7 +25,7 @@ def show_operation do
|
||||||
|
|
||||||
def show2_operation do
|
def show2_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Instance"],
|
tags: ["Instance misc"],
|
||||||
summary: "Retrieve instance information",
|
summary: "Retrieve instance information",
|
||||||
description: "Information about the server",
|
description: "Information about the server",
|
||||||
operationId: "InstanceController.show2",
|
operationId: "InstanceController.show2",
|
||||||
|
@ -48,7 +48,7 @@ def peers_operation do
|
||||||
|
|
||||||
def rules_operation do
|
def rules_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Instance"],
|
tags: ["Instance misc"],
|
||||||
summary: "Retrieve list of instance rules",
|
summary: "Retrieve list of instance rules",
|
||||||
operationId: "InstanceController.rules",
|
operationId: "InstanceController.rules",
|
||||||
responses: %{
|
responses: %{
|
||||||
|
@ -59,7 +59,7 @@ def rules_operation do
|
||||||
|
|
||||||
def domain_blocks_operation do
|
def domain_blocks_operation do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Instance"],
|
tags: ["Instance misc"],
|
||||||
summary: "Retrieve instance domain blocks",
|
summary: "Retrieve instance domain blocks",
|
||||||
operationId: "InstanceController.domain_blocks",
|
operationId: "InstanceController.domain_blocks",
|
||||||
responses: %{
|
responses: %{
|
||||||
|
|
|
@ -2727,8 +2727,6 @@ test "returns fully qualified nickname for local users" do
|
||||||
test "returns fully qualified nickname for local users when using different domain for webfinger" do
|
test "returns fully qualified nickname for local users when using different domain for webfinger" do
|
||||||
clear_config([Pleroma.Web.WebFinger, :domain], "plemora.dev")
|
clear_config([Pleroma.Web.WebFinger, :domain], "plemora.dev")
|
||||||
|
|
||||||
host = Pleroma.Web.Endpoint.host()
|
|
||||||
|
|
||||||
local_user = insert(:user, nickname: "local_user")
|
local_user = insert(:user, nickname: "local_user")
|
||||||
|
|
||||||
assert User.full_nickname(local_user) == "local_user@plemora.dev"
|
assert User.full_nickname(local_user) == "local_user@plemora.dev"
|
||||||
|
|
|
@ -2229,7 +2229,7 @@ test "it returns 404 if the user cannot see the post", %{conn: conn} do
|
||||||
|
|
||||||
test "it translates a status to user language" do
|
test "it translates a status to user language" do
|
||||||
user = insert(:user, language: "fr")
|
user = insert(:user, language: "fr")
|
||||||
%{conn: conn, user: user} = oauth_access(["read:statuses"], user: user)
|
%{conn: conn} = oauth_access(["read:statuses"], user: user)
|
||||||
another_user = insert(:user)
|
another_user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} =
|
{:ok, activity} =
|
||||||
|
@ -2252,7 +2252,7 @@ test "it translates a status to user language" do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it returns an error if no target language provided" do
|
test "it returns an error if no target language provided" do
|
||||||
%{conn: conn, user: user} = oauth_access(["read:statuses"])
|
%{conn: conn} = oauth_access(["read:statuses"])
|
||||||
another_user = insert(:user)
|
another_user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} =
|
{:ok, activity} =
|
||||||
|
@ -2261,10 +2261,9 @@ test "it returns an error if no target language provided" do
|
||||||
language: "pl"
|
language: "pl"
|
||||||
})
|
})
|
||||||
|
|
||||||
response =
|
conn
|
||||||
conn
|
|> post("/api/v1/statuses/#{activity.id}/translate")
|
||||||
|> post("/api/v1/statuses/#{activity.id}/translate")
|
|> json_response_and_validate_schema(400)
|
||||||
|> json_response_and_validate_schema(400)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
test "it doesn't translate non-public statuses" do
|
test "it doesn't translate non-public statuses" do
|
||||||
|
@ -2277,10 +2276,9 @@ test "it doesn't translate non-public statuses" do
|
||||||
language: "pl"
|
language: "pl"
|
||||||
})
|
})
|
||||||
|
|
||||||
response =
|
conn
|
||||||
conn
|
|> post("/api/v1/statuses/#{activity.id}/translate")
|
||||||
|> post("/api/v1/statuses/#{activity.id}/translate")
|
|> json_response_and_validate_schema(404)
|
||||||
|> json_response_and_validate_schema(404)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -175,7 +175,7 @@ test "don't display requests if not an author", %{conn: conn} do
|
||||||
[user: user, conn: conn]
|
[user: user, conn: conn]
|
||||||
end
|
end
|
||||||
|
|
||||||
test "joins an event", %{conn: conn, user: user} do
|
test "joins an event", %{conn: conn} do
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
|
|
||||||
{:ok, activity} =
|
{:ok, activity} =
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
defmodule Pleroma.WebhookTest do
|
defmodule Pleroma.WebhookTest do
|
||||||
use Pleroma.DataCase, async: true
|
use Pleroma.DataCase, async: true
|
||||||
|
|
||||||
alias Pleroma.Repo
|
|
||||||
alias Pleroma.Webhook
|
alias Pleroma.Webhook
|
||||||
|
|
||||||
test "creating a webhook" do
|
test "creating a webhook" do
|
||||||
|
|
Loading…
Reference in a new issue