diff options
author | lain <lain@soykaf.club> | 2020-11-17 16:43:07 +0100 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-11-17 16:43:07 +0100 |
commit | bb9650f3c26c0a6155cfb15f5e4da8257316661a (patch) | |
tree | 2ae3b299611206988b84c46cfa0396e02b73eccc /test | |
parent | f69fe36ebfdb6fad4af853f002705f5ea3c697a1 (diff) | |
download | pleroma-bb9650f3c26c0a6155cfb15f5e4da8257316661a.tar.gz pleroma-bb9650f3c26c0a6155cfb15f5e4da8257316661a.zip |
FrontendController: Return error on installation error.
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/admin_api/controllers/frontend_controller_test.exs | 19 |
1 files changed, 19 insertions, 0 deletions
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 db28a27b6..94873f6db 100644 --- a/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs +++ b/test/pleroma/web/admin_api/controllers/frontend_controller_test.exs @@ -118,5 +118,24 @@ defmodule Pleroma.Web.AdminAPI.FrontendControllerTest do assert File.exists?(Path.join([@dir, "frontends", "unknown", "baka", "test.txt"])) end + + test "failing returns an error", %{conn: conn} do + Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/madeup.zip"} -> + %Tesla.Env{status: 404, body: ""} + end) + + result = + conn + |> put_req_header("content-type", "application/json") + |> post("/api/pleroma/admin/frontends/install", %{ + name: "unknown", + ref: "baka", + build_url: "http://gensokyo.2hu/madeup.zip", + build_dir: "" + }) + |> json_response_and_validate_schema(400) + + assert result == %{"error" => "Could not download or unzip the frontend"} + end end end |