Merge pull request 'Fix OpenAPI spec for preferred_frontend endpoint' (#680) from katafrakt/akkoma:fix-openapi-spec-for-preferred-frontend into develop
Reviewed-on: #680
This commit is contained in:
commit
c5dcd07e08
2 changed files with 22 additions and 6 deletions
|
@ -111,9 +111,9 @@ def available_frontends_operation() do
|
||||||
def update_preferred_frontend_operation() do
|
def update_preferred_frontend_operation() do
|
||||||
%Operation{
|
%Operation{
|
||||||
tags: ["Frontends"],
|
tags: ["Frontends"],
|
||||||
summary: "Frontend Settings Profiles",
|
summary: "Update preferred frontend setting",
|
||||||
description: "List frontend setting profiles",
|
description: "Store preferred frontend in cookies",
|
||||||
operationId: "AkkomaAPI.FrontendSettingsController.available_frontends",
|
operationId: "AkkomaAPI.FrontendSettingsController.update_preferred_frontend",
|
||||||
requestBody:
|
requestBody:
|
||||||
request_body(
|
request_body(
|
||||||
"Frontend",
|
"Frontend",
|
||||||
|
@ -132,9 +132,11 @@ def update_preferred_frontend_operation() do
|
||||||
responses: %{
|
responses: %{
|
||||||
200 =>
|
200 =>
|
||||||
Operation.response("Frontends", "application/json", %Schema{
|
Operation.response("Frontends", "application/json", %Schema{
|
||||||
type: :array,
|
type: :object,
|
||||||
items: %Schema{
|
properties: %{
|
||||||
type: :string
|
frontend_name: %Schema{
|
||||||
|
type: :string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,4 +119,18 @@ test "deletes a config" do
|
||||||
) == nil
|
) == nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "PUT /api/v1/akkoma/preferred_frontend" do
|
||||||
|
test "sets a cookie with selected frontend" do
|
||||||
|
%{conn: conn} = oauth_access(["read"])
|
||||||
|
|
||||||
|
response =
|
||||||
|
conn
|
||||||
|
|> put_req_header("content-type", "application/json")
|
||||||
|
|> put("/api/v1/akkoma/preferred_frontend", %{"frontend_name" => "pleroma-fe/stable"})
|
||||||
|
|
||||||
|
json_response_and_validate_schema(response, 200)
|
||||||
|
assert %{"preferred_frontend" => %{value: "pleroma-fe/stable"}} = response.resp_cookies
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue