diff options
author | feld <feld@feld.me> | 2020-10-13 14:47:29 +0000 |
---|---|---|
committer | feld <feld@feld.me> | 2020-10-13 14:47:29 +0000 |
commit | 8b6221d4ecd1d7e354e7de831dd46e285cb85077 (patch) | |
tree | 992e96bbdf4b40a5738ca2306ba3acf4158b17d5 /test/tasks/frontend_test.exs | |
parent | eea879eb362d3310d4fe047fb6412b69dd8711fe (diff) | |
parent | 4c4ea9a3486f824cfba825a176439d50ec54fe95 (diff) | |
download | pleroma-8b6221d4ecd1d7e354e7de831dd46e285cb85077.tar.gz pleroma-8b6221d4ecd1d7e354e7de831dd46e285cb85077.zip |
Merge branch 'feature/1822-files-consistency' into 'develop'
Feature/1822 files consistency
Closes #1822
See merge request pleroma/pleroma!2680
Diffstat (limited to 'test/tasks/frontend_test.exs')
-rw-r--r-- | test/tasks/frontend_test.exs | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/test/tasks/frontend_test.exs b/test/tasks/frontend_test.exs deleted file mode 100644 index 022ae51be..000000000 --- a/test/tasks/frontend_test.exs +++ /dev/null @@ -1,85 +0,0 @@ -# Pleroma: A lightweight social networking server -# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/> -# SPDX-License-Identifier: AGPL-3.0-only - -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 - File.mkdir_p!(@dir) - clear_config([:instance, :static_dir], @dir) - - on_exit(fn -> - File.rm_rf(@dir) - end) - end - - test "it downloads and unzips a known frontend" do - clear_config([:frontends, :available], %{ - "pleroma" => %{ - "ref" => "fantasy", - "name" => "pleroma", - "build_url" => "http://gensokyo.2hu/builds/${ref}" - } - }) - - Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/builds/fantasy"} -> - %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend_dist.zip")} - end) - - capture_io(fn -> - Frontend.run(["install", "pleroma"]) - end) - - assert File.exists?(Path.join([@dir, "frontends", "pleroma", "fantasy", "test.txt"])) - end - - test "it also works given a file" do - clear_config([:frontends, :available], %{ - "pleroma" => %{ - "ref" => "fantasy", - "name" => "pleroma", - "build_dir" => "" - } - }) - - folder = Path.join([@dir, "frontends", "pleroma", "fantasy"]) - previously_existing = Path.join([folder, "temp"]) - File.mkdir_p!(folder) - File.write!(previously_existing, "yey") - assert File.exists?(previously_existing) - - capture_io(fn -> - Frontend.run(["install", "pleroma", "--file", "test/fixtures/tesla_mock/frontend.zip"]) - end) - - assert File.exists?(Path.join([folder, "test.txt"])) - refute File.exists?(previously_existing) - end - - test "it downloads and unzips unknown frontends" do - Tesla.Mock.mock(fn %{url: "http://gensokyo.2hu/madeup.zip"} -> - %Tesla.Env{status: 200, body: File.read!("test/fixtures/tesla_mock/frontend.zip")} - end) - - 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 -end |