-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathconfig_test.exs
46 lines (37 loc) · 1.04 KB
/
config_test.exs
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
defmodule Rig.ConfigTest do
@moduledoc false
use ExUnit.Case, async: true
alias Rig.Config
test "should add rig/priv to cert-path config" do
config = [
https: [
port: 4001,
otp_app: :rig,
cipher_suite: :strong,
certfile: "cert/selfsigned.pem",
keyfile: "cert/selfsigned_key.des3.pem",
password: "test"
]
]
config = config |> Config.check_and_update_https_config()
assert config[:https][:certfile]
|> String.contains?("rig/priv/cert/selfsigned.pem")
assert config[:https][:keyfile]
|> String.contains?("rig/priv/cert/selfsigned_key.des3.pem")
assert is_list(config[:https][:password])
end
test "should set https to false if certfile is empty string" do
config = [
https: [
port: 4001,
otp_app: :rig,
cipher_suite: :strong,
certfile: "",
keyfile: "",
password: ""
]
]
config = config |> Config.check_and_update_https_config()
assert config[:https] == false
end
end