-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,71 @@ | ||
defmodule ExSecretsTest do | ||
use ExUnit.Case, async: false | ||
doctest ExSecrets | ||
|
||
# test "Get FOO - nil" do | ||
# k = "FOO#{:rand.uniform(100)}" | ||
# assert ExSecrets.get(k) == nil | ||
# end | ||
doctest ExSecrets, async: false | ||
|
||
# test "Get FOO - BAR" do | ||
# k = "FOO#{:rand.uniform(1000)}" | ||
# System.put_env(k, "BAR") | ||
# assert ExSecrets.get(k) == "BAR" | ||
# System.delete_env(k) | ||
# end | ||
test "Get FOO - nil" do | ||
k = "FOO#{:rand.uniform(100)}" | ||
assert ExSecrets.get(k) == nil | ||
end | ||
|
||
# test "Get with Provider FOO - BAR" do | ||
# k = "FOO#{:rand.uniform(1000)}" | ||
# System.put_env(k, "BARR") | ||
# assert ExSecrets.get(k, :system_env) == "BARR" | ||
# System.delete_env(k) | ||
# end | ||
test "Get FOO - BAR" do | ||
k = "FOO#{:rand.uniform(1000)}" | ||
System.put_env(k, "BAR") | ||
assert ExSecrets.get(k) == "BAR" | ||
System.delete_env(k) | ||
end | ||
|
||
# test "Get with wring Provider FOOOZ - BARRZ" do | ||
# k = "FOO#{:rand.uniform(1000)}" | ||
# assert ExSecrets.get(k, :abc) == nil | ||
# System.delete_env(k) | ||
# end | ||
test "Get with Provider FOO - BAR" do | ||
k = "FOO#{:rand.uniform(1000)}" | ||
System.put_env(k, "BARR") | ||
assert ExSecrets.get(k, :system_env) == "BARR" | ||
System.delete_env(k) | ||
end | ||
|
||
# test "Get with configuration FOO - BAR" do | ||
# k = "FOO#{:rand.uniform(1000)}" | ||
# Application.put_env(:ex_secrets, :providers, %{xyz: %{path: "test"}}) | ||
# System.put_env(k, "BARR") | ||
# assert ExSecrets.get(k, :system_env) == "BARR" | ||
# System.delete_env(k) | ||
# Application.delete_env(:ex_secrets, :providers) | ||
# end | ||
test "Get with wring Provider FOOOZ - BARRZ" do | ||
k = "FOO#{:rand.uniform(1000)}" | ||
assert ExSecrets.get(k, :abc) == nil | ||
System.delete_env(k) | ||
end | ||
|
||
# test "GET from System env if " do | ||
# k = "FOO#{:rand.uniform(1000)}" | ||
# Application.put_env(:ex_secrets, :providers, %{xyz: %{path: "test"}}) | ||
# System.put_env(k, "BARR") | ||
# assert ExSecrets.get(k) == "BARR" | ||
# System.delete_env(k) | ||
# Application.delete_env(:ex_secrets, :providers) | ||
# end | ||
test "Get with configuration FOO - BAR" do | ||
k = "FOO#{:rand.uniform(1000)}" | ||
Application.put_env(:ex_secrets, :providers, %{xyz: %{path: "test"}}) | ||
System.put_env(k, "BARR") | ||
assert ExSecrets.get(k, :system_env) == "BARR" | ||
System.delete_env(k) | ||
Application.delete_env(:ex_secrets, :providers) | ||
end | ||
|
||
# test "reset" do | ||
# Application.put_env(:ex_secrets, :providers, %{ | ||
# dot_env: %{path: "test/support/fixtures/dot_env_test.env"} | ||
# }) | ||
test "GET from System env if " do | ||
k = "FOO#{:rand.uniform(1000)}" | ||
Application.put_env(:ex_secrets, :providers, %{xyz: %{path: "test"}}) | ||
System.put_env(k, "BARR") | ||
assert ExSecrets.get(k) == "BARR" | ||
System.delete_env(k) | ||
Application.delete_env(:ex_secrets, :providers) | ||
end | ||
|
||
# {:ok, _} = GenServer.start(ExSecrets.Providers.DotEnv, []) | ||
# assert ExSecrets.get("JAVA", :dot_env) == "SCRIPT" | ||
test "reset" do | ||
Application.put_env(:ex_secrets, :providers, %{ | ||
dot_env: %{path: "test/support/fixtures/dot_env_test.env"} | ||
}) | ||
|
||
# Application.put_env(:ex_secrets, :providers, %{ | ||
# dot_env: %{path: "test/support/fixtures/dot_env_test_3.env"} | ||
# }) | ||
{:ok, _} = GenServer.start(ExSecrets.Providers.DotEnv, []) | ||
assert ExSecrets.get("JAVA", :dot_env) == "SCRIPT" | ||
|
||
# ExSecrets.reset() | ||
Application.put_env(:ex_secrets, :providers, %{ | ||
dot_env: %{path: "test/support/fixtures/dot_env_test_3.env"} | ||
}) | ||
|
||
# assert ExSecrets.get("JAVA", :dot_env) == "SCRIPTT" | ||
ExSecrets.reset() | ||
|
||
# Application.put_env(:ex_secrets, :providers, %{ | ||
# dot_env: %{path: "test/support/fixtures/dot_env_test.env"} | ||
# }) | ||
assert ExSecrets.get("JAVA", :dot_env) == "SCRIPTT" | ||
|
||
# Application.delete_env(:ex_secrets, :providers) | ||
# end | ||
Application.put_env(:ex_secrets, :providers, %{ | ||
dot_env: %{path: "test/support/fixtures/dot_env_test.env"} | ||
}) | ||
|
||
Application.delete_env(:ex_secrets, :providers) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
JAVA=SCRIPT | ||
ER=LANG | ||
DEVS=ROCKS |