diff options
author | lain <lain@soykaf.club> | 2020-08-07 15:27:41 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-08-07 15:27:41 +0200 |
commit | de00a4c0f1cc5d61d0a821a2d0a292f8bd95e3f1 (patch) | |
tree | 1add8d694eddf6ef05982db0b82bce3f3ba1b3a9 /test/tasks/frontend_test.exs | |
parent | d97b76104eabcd670aa78b8281832ab128373d36 (diff) | |
download | pleroma-de00a4c0f1cc5d61d0a821a2d0a292f8bd95e3f1.tar.gz |
Mix Task Frontend Test: Capture IO.
Diffstat (limited to 'test/tasks/frontend_test.exs')
-rw-r--r-- | test/tasks/frontend_test.exs | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/test/tasks/frontend_test.exs b/test/tasks/frontend_test.exs index 5cd4594e2..6a9a931eb 100644 --- a/test/tasks/frontend_test.exs +++ b/test/tasks/frontend_test.exs @@ -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 @@ defmodule Pleroma.FrontendTest 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 @@ defmodule Pleroma.FrontendTest 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 @@ defmodule Pleroma.FrontendTest 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 |