forked from Versent/saml2aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig_test.go
43 lines (30 loc) · 886 Bytes
/
config_test.go
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
package saml2aws
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestUpdateConfig(t *testing.T) {
config := &ConfigLoader{".aws2saml.config", "adfs"}
username, err := config.LoadUsername()
assert.Nil(t, err)
assert.Equal(t, "", username)
err = config.SaveUsername("[email protected]")
assert.Nil(t, err)
username, err = config.LoadUsername()
assert.Nil(t, err)
assert.Equal(t, "[email protected]", username)
os.Remove(".aws2saml.config")
}
func TestUpdateHostnameConfig(t *testing.T) {
config := &ConfigLoader{".aws2saml.config", "adfs"}
hostname, err := config.LoadHostname()
assert.Nil(t, err)
assert.Equal(t, "", hostname)
err = config.SaveHostname("id.example.com")
assert.Nil(t, err)
hostname, err = config.LoadHostname()
assert.Nil(t, err)
assert.Equal(t, "id.example.com", hostname)
os.Remove(".aws2saml.config")
}