Mix Task Frontend Test: Capture IO.
This commit is contained in:
parent
d97b76104e
commit
de00a4c0f1
1 changed files with 22 additions and 12 deletions
|
@ -6,6 +6,8 @@ defmodule Pleroma.FrontendTest do
|
||||||
use Pleroma.DataCase
|
use Pleroma.DataCase
|
||||||
alias Mix.Tasks.Pleroma.Frontend
|
alias Mix.Tasks.Pleroma.Frontend
|
||||||
|
|
||||||
|
import ExUnit.CaptureIO, only: [capture_io: 1]
|
||||||
|
|
||||||
@dir "test/frontend_static_test"
|
@dir "test/frontend_static_test"
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
|
@ -31,7 +33,10 @@ 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.run(["install", "pleroma"])
|
Frontend.run(["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
|
||||||
|
|
||||||
|
@ -44,7 +49,10 @@ defmodule Pleroma.FrontendTest do
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
capture_io(fn ->
|
||||||
Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"])
|
Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"])
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -53,6 +61,7 @@ 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.run([
|
Frontend.run([
|
||||||
"install",
|
"install",
|
||||||
"unknown",
|
"unknown",
|
||||||
|
@ -63,6 +72,7 @@ defmodule Pleroma.FrontendTest do
|
||||||
"--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
|
||||||
|
|
Loading…
Reference in a new issue