FrontendStaticPlug: Add test for static files outside of index
This commit is contained in:
parent
9129c65795
commit
00ca971390
1 changed files with 11 additions and 0 deletions
|
|
@ -122,16 +122,27 @@ defmodule Pleroma.Web.Plugs.FrontendStaticPlugTest do
|
||||||
|
|
||||||
clear_config([:frontends, :pickable], ["#{name}/#{ref}"])
|
clear_config([:frontends, :pickable], ["#{name}/#{ref}"])
|
||||||
path = "#{@dir}/frontends/#{name}/#{ref}"
|
path = "#{@dir}/frontends/#{name}/#{ref}"
|
||||||
|
path2 = "#{@dir}/frontends/#{name}/#{ref}/packs/html"
|
||||||
|
|
||||||
Pleroma.Backports.mkdir_p!(path)
|
Pleroma.Backports.mkdir_p!(path)
|
||||||
File.write!("#{path}/index.html", "from frontend plug")
|
File.write!("#{path}/index.html", "from frontend plug")
|
||||||
|
|
||||||
|
Pleroma.Backports.mkdir_p!(path2)
|
||||||
|
File.write!("#{path2}/custom.html", "from frontend plug")
|
||||||
|
|
||||||
index =
|
index =
|
||||||
conn
|
conn
|
||||||
|> put_req_cookie("preferred_frontend", "#{name}/#{ref}")
|
|> put_req_cookie("preferred_frontend", "#{name}/#{ref}")
|
||||||
|> get("/")
|
|> get("/")
|
||||||
|
|
||||||
assert html_response(index, 200) == "from frontend plug"
|
assert html_response(index, 200) == "from frontend plug"
|
||||||
|
|
||||||
|
custom =
|
||||||
|
conn
|
||||||
|
|> put_req_cookie("preferred_frontend", "#{name}/#{ref}")
|
||||||
|
|> get("/packs/html/custom.html")
|
||||||
|
|
||||||
|
assert html_response(custom, 200) == "from frontend plug"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "only returns content from pickable frontends", %{conn: conn} do
|
test "only returns content from pickable frontends", %{conn: conn} do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue