|
|
@ -6,8 +6,6 @@ defmodule Pleroma.FrontendTest do
|
|
|
|
use Pleroma.DataCase
|
|
|
|
use Pleroma.DataCase
|
|
|
|
alias Pleroma.Frontend
|
|
|
|
alias Pleroma.Frontend
|
|
|
|
|
|
|
|
|
|
|
|
import ExUnit.CaptureIO, only: [capture_io: 1]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dir "test/frontend_static_test"
|
|
|
|
@dir "test/frontend_static_test"
|
|
|
|
|
|
|
|
|
|
|
|
setup do
|
|
|
|
setup do
|
|
|
@ -32,9 +30,7 @@ defmodule Pleroma.FrontendTest do
|
|
|
|
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend_dist.zip")}
|
|
|
|
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend_dist.zip")}
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
capture_io(fn ->
|
|
|
|
Frontend.install("pleroma")
|
|
|
|
Frontend.install("pleroma")
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
|
|
|
|
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -54,9 +50,7 @@ defmodule Pleroma.FrontendTest do
|
|
|
|
File.write!(previously_existing, "yey")
|
|
|
|
File.write!(previously_existing, "yey")
|
|
|
|
assert File.exists?(previously_existing)
|
|
|
|
assert File.exists?(previously_existing)
|
|
|
|
|
|
|
|
|
|
|
|
capture_io(fn ->
|
|
|
|
Frontend.install("pleroma", file: "test/fixtures/tesla_mock/frontend.zip")
|
|
|
|
Frontend.install("pleroma", file: "test/fixtures/tesla_mock/frontend.zip")
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert File.exists?(Path.join([folder, "test.txt"]))
|
|
|
|
assert File.exists?(Path.join([folder, "test.txt"]))
|
|
|
|
refute File.exists?(previously_existing)
|
|
|
|
refute File.exists?(previously_existing)
|
|
|
@ -67,13 +61,11 @@ defmodule Pleroma.FrontendTest do
|
|
|
|
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")}
|
|
|
|
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")}
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
capture_io(fn ->
|
|
|
|
Frontend.install("unknown",
|
|
|
|
Frontend.install("unknown",
|
|
|
|
ref: "baka",
|
|
|
|
ref: "baka",
|
|
|
|
build_url: "http://gensokyo.2hu/madeup.zip",
|
|
|
|
build_url: "http://gensokyo.2hu/madeup.zip",
|
|
|
|
build_dir: ""
|
|
|
|
build_dir: ""
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assert File.exists?(Path.join([@dir, "frontends", "unknown", "baka", "test.txt"]))
|
|
|
|
assert File.exists?(Path.join([@dir, "frontends", "unknown", "baka", "test.txt"]))
|
|
|
|
end
|
|
|
|
end
|
|
|
|