-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathutils_test.go
More file actions
46 lines (35 loc) · 921 Bytes
/
utils_test.go
File metadata and controls
46 lines (35 loc) · 921 Bytes
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
package client
import (
"os"
"testing"
)
func TestChooseSettingsFileLocation(t *testing.T) {
os.Unsetenv("DEIS_PROFILE")
os.Setenv("HOME", "/home/test")
expected := "/home/test/.deis/client.json"
actual := locateSettingsFile()
if actual != expected {
t.Errorf("Expected %s, Got %s", expected, actual)
}
}
func TestChooseSettingsFileUsingProfile(t *testing.T) {
os.Setenv("DEIS_PROFILE", "testing")
os.Setenv("HOME", "/home/test")
expected := "/home/test/.deis/testing.json"
actual := locateSettingsFile()
if actual != expected {
t.Errorf("Expected %s, Got %s", expected, actual)
}
}
func TestDeleteSettings(t *testing.T) {
if err := createTempProfile(""); err != nil {
t.Fatal(err)
}
if err := deleteSettings(); err != nil {
t.Fatal(err)
}
file := locateSettingsFile()
if _, err := os.Stat(file); err == nil {
t.Errorf("File %s exists, supposed to have been deleted.", file)
}
}