Change endpoint path

This commit is contained in:
Egor Kislitsyn 2020-11-11 20:39:57 +04:00
parent 435bf1f945
commit d26a449396
No known key found for this signature in database
GPG Key ID: 1B49CB15B71E7805
3 changed files with 6 additions and 7 deletions

View File

@ -1525,8 +1525,7 @@ Returns the content of the document
] ]
``` ```
## `POST /api/pleroma/admin/frontends/install
## `POST /api/pleroma/admin/frontends
### Install a frontend ### Install a frontend

View File

@ -245,7 +245,7 @@ defmodule Pleroma.Web.Router do
delete("/chats/:id/messages/:message_id", ChatController, :delete_message) delete("/chats/:id/messages/:message_id", ChatController, :delete_message)
get("/frontends", FrontendController, :index) get("/frontends", FrontendController, :index)
post("/frontends", FrontendController, :install) post("/frontends/install", FrontendController, :install)
post("/backups", AdminAPIController, :create_backup) post("/backups", AdminAPIController, :create_backup)
end end

View File

@ -44,7 +44,7 @@ test "it lists available frontends", %{conn: conn} do
end end
end end
describe "POST /api/pleroma/admin/frontends" do describe "POST /api/pleroma/admin/frontends/install" do
test "from available frontends", %{conn: conn} do test "from available frontends", %{conn: conn} do
clear_config([:frontends, :available], %{ clear_config([:frontends, :available], %{
"pleroma" => %{ "pleroma" => %{
@ -60,7 +60,7 @@ test "from available frontends", %{conn: conn} do
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("/api/pleroma/admin/frontends", %{name: "pleroma"}) |> post("/api/pleroma/admin/frontends/install", %{name: "pleroma"})
|> json_response_and_validate_schema(:ok) |> json_response_and_validate_schema(:ok)
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"])) assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
@ -92,7 +92,7 @@ test "from a file", %{conn: conn} do
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("/api/pleroma/admin/frontends", %{ |> post("/api/pleroma/admin/frontends/install", %{
name: "pleroma", name: "pleroma",
file: "test/fixtures/tesla_mock/frontend.zip" file: "test/fixtures/tesla_mock/frontend.zip"
}) })
@ -108,7 +108,7 @@ test "from an URL", %{conn: conn} do
conn conn
|> put_req_header("content-type", "application/json") |> put_req_header("content-type", "application/json")
|> post("/api/pleroma/admin/frontends", %{ |> post("/api/pleroma/admin/frontends/install", %{
name: "unknown", name: "unknown",
ref: "baka", ref: "baka",
build_url: "http://gensokyo.2hu/madeup.zip", build_url: "http://gensokyo.2hu/madeup.zip",