aboutsummaryrefslogtreecommitdiff
path: root/test/exdatadog/config_test.exs
blob: 2be0c3820def3deff4ac7ed91f3b8c86f1c7962e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
defmodule Exdatadog.Config.Test do
  @moduledoc """
  Provides tests for Exdatadog.Config
  """
  use ExUnit.Case

  import Exdatadog.Config

  setup_all do
    System.put_env("TEST_VAR", "BAR")
    Application.put_env(:test_app, :test_key, {:system, "TEST_VAR"})
    Application.put_env(:test_app, :test_foo, "FOO")

    on_exit fn ->
      System.delete_env("TEST_VAR")
      Application.delete_env(:test_app, :test_key)
      Application.delete_env(:test_app, :test_foo)
    end

  end

  test "can read variable from application settings" do
    assert get_env_var(:test_app, :test_foo) == "FOO"
  end

  test "can read environment variables for settings" do
    assert get_env_var(:test_app, :test_key) == "BAR"
  end

end