Mix Task Frontend Test: Capture IO.
This commit is contained in:
parent
d97b76104e
commit
de00a4c0f1
|
@ -6,6 +6,8 @@ defmodule Pleroma.FrontendTest do
|
|||
use Pleroma.DataCase
|
||||
alias Mix.Tasks.Pleroma.Frontend
|
||||
|
||||
import ExUnit.CaptureIO, only: [capture_io: 1]
|
||||
|
||||
@dir "test/frontend_static_test"
|
||||
|
||||
setup do
|
||||
|
@ -31,7 +33,10 @@ test "it downloads and unzips a known frontend" do
|
|||
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")}
|
||||
end)
|
||||
|
||||
Frontend.run(["install", "pleroma"])
|
||||
capture_io(fn ->
|
||||
Frontend.run(["install", "pleroma"])
|
||||
end)
|
||||
|
||||
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
|
||||
end
|
||||
|
||||
|
@ -44,7 +49,10 @@ test "it also works given a file" do
|
|||
}
|
||||
})
|
||||
|
||||
Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"])
|
||||
capture_io(fn ->
|
||||
Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"])
|
||||
end)
|
||||
|
||||
assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"]))
|
||||
end
|
||||
|
||||
|
@ -53,16 +61,18 @@ test "it downloads and unzips unknown frontends" do
|
|||
%Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")}
|
||||
end)
|
||||
|
||||
Frontend.run([
|
||||
"install",
|
||||
"unknown",
|
||||
"--ref",
|
||||
"baka",
|
||||
"--build-url",
|
||||
"http://gensokyo.2hu/madeup.zip",
|
||||
"--build-dir",
|
||||
""
|
||||
])
|
||||
capture_io(fn ->
|
||||
Frontend.run([
|
||||
"install",
|
||||
"unknown",
|
||||
"--ref",
|
||||
"baka",
|
||||
"--build-url",
|
||||
"http://gensokyo.2hu/madeup.zip",
|
||||
"--build-dir",
|
||||
""
|
||||
])
|
||||
end)
|
||||
|
||||
assert File.exists?(Path.join([@dir, "frontends", "unknown", "baka", "test.txt"]))
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue