519f1eba9c69b9fbaa94d0435efb87bffacf4056
[akkoma] / test / mix / tasks / pleroma / release_env_test.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Mix.Tasks.Pleroma.ReleaseEnvTest do
6 use ExUnit.Case
7 import ExUnit.CaptureIO, only: [capture_io: 1]
8
9 @path "config/pleroma.test.env"
10
11 def do_clean do
12 if File.exists?(@path) do
13 File.rm_rf(@path)
14 end
15 end
16
17 setup do
18 do_clean()
19 on_exit(fn -> do_clean() end)
20 :ok
21 end
22
23 test "generate pleroma.env" do
24 assert capture_io(fn ->
25 Mix.Tasks.Pleroma.ReleaseEnv.run(["gen", "--path", @path, "--force"])
26 end) =~ "The file generated"
27
28 assert File.read!(@path) =~ "RELEASE_COOKIE="
29 end
30 end