From d26a4493960cc9d99183dfcd18464040213ac91e Mon Sep 17 00:00:00 2001 From: Egor Kislitsyn Date: Wed, 11 Nov 2020 20:39:57 +0400 Subject: [PATCH] Change endpoint path --- docs/API/admin_api.md | 3 +-- lib/pleroma/web/router.ex | 2 +- .../admin_api/controllers/frontend_controller_test.exs | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/API/admin_api.md b/docs/API/admin_api.md index cbf4b9134..e18d5e513 100644 --- a/docs/API/admin_api.md +++ b/docs/API/admin_api.md @@ -1525,8 +1525,7 @@ Returns the content of the document ] ``` - -## `POST /api/pleroma/admin/frontends +## `POST /api/pleroma/admin/frontends/install ### Install a frontend diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex index f497a96b7..75a885377 100644 --- a/lib/pleroma/web/router.ex +++ b/lib/pleroma/web/router.ex @@ -245,7 +245,7 @@ defmodule Pleroma.Web.Router do delete("/chats/:id/messages/:message_id", ChatController, :delete_message) get("/frontends", FrontendController, :index) - post("/frontends", FrontendController, :install) + post("/frontends/install", FrontendController, :install) post("/backups", AdminAPIController, :create_backup) end diff --git a/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs index 1d4fbfa03..db28a27b6 100644 --- a/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs @@ -44,7 +44,7 @@ test "it lists available frontends", %{conn: conn} do end end - describe "POST /api/pleroma/admin/frontends" do + describe "POST /api/pleroma/admin/frontends/install" do test "from available frontends", %{conn: conn} do clear_config([:frontends, :available], %{ "pleroma" => %{ @@ -60,7 +60,7 @@ test "from available frontends", %{conn: conn} do conn |> 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) assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"])) @@ -92,7 +92,7 @@ test "from a file", %{conn: conn} do conn |> put_req_header("content-type", "application/json") - |> post("/api/pleroma/admin/frontends", %{ + |> post("/api/pleroma/admin/frontends/install", %{ name: "pleroma", file: "test/fixtures/tesla_mock/frontend.zip" }) @@ -108,7 +108,7 @@ test "from an URL", %{conn: conn} do conn |> put_req_header("content-type", "application/json") - |> post("/api/pleroma/admin/frontends", %{ + |> post("/api/pleroma/admin/frontends/install", %{ name: "unknown", ref: "baka", build_url: "http://gensokyo.2hu/madeup.zip",