diff options
author | lain <lain@soykaf.club> | 2020-07-28 17:35:16 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-28 17:35:16 +0200 |
commit | ad5c42628ab36eb506ee20d0458c5cfd5bbe79ab (patch) | |
tree | eac339a56e7d49f6d0ab5b825ab1e9fd7233d508 /test/plugs/frontend_static_test.exs | |
parent | 14c28dcbd1b534c2749401c148dd973181a00fec (diff) | |
download | pleroma-ad5c42628ab36eb506ee20d0458c5cfd5bbe79ab.tar.gz pleroma-ad5c42628ab36eb506ee20d0458c5cfd5bbe79ab.zip |
FrontendStatic: Add plug to serve frontends based on configuration.
Diffstat (limited to 'test/plugs/frontend_static_test.exs')
-rw-r--r-- | test/plugs/frontend_static_test.exs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/plugs/frontend_static_test.exs b/test/plugs/frontend_static_test.exs new file mode 100644 index 000000000..d11d91d78 --- /dev/null +++ b/test/plugs/frontend_static_test.exs @@ -0,0 +1,30 @@ +# Pleroma: A lightweight social networking server +# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> +# SPDX-License-Identifier: AGPL-3.0-only + +defmodule Pleroma.Web.FrontendStaticPlugTest do + use Pleroma.Web.ConnCase + + @dir "test/tmp/instance_static" + + setup do + File.mkdir_p!(@dir) + on_exit(fn -> File.rm_rf(@dir) end) + end + + setup do: clear_config([:instance, :static_dir], @dir) + + test "overrides existing static files", %{conn: conn} do + name = "pelmora" + ref = "uguu" + + clear_config([:frontends, :primary], %{"name" => name, "ref" => ref}) + path = "#{@dir}/frontends/#{name}/#{ref}" + + File.mkdir_p!(path) + File.write!("#{path}/index.html", "from frontend plug") + + index = get(conn, "/") + assert html_response(index, 200) == "from frontend plug" + end +end |