-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathintegration_test.go
More file actions
51 lines (45 loc) · 1.35 KB
/
integration_test.go
File metadata and controls
51 lines (45 loc) · 1.35 KB
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
47
48
49
50
51
// +build integration
package tests
import (
"os"
"os/user"
"testing"
"github.com/deis/deis/tests/utils"
)
var (
gitCloneCmd = "if [ ! -d {{.ExampleApp}} ] ; then git clone https://github.com/deis/{{.ExampleApp}}.git ; fi"
gitRemoveCmd = "git remote remove deis"
gitPushCmd = "git push deis master"
)
func TestGlobal(t *testing.T) {
params := utils.GetGlobalConfig()
cookieTest(t, params)
utils.Execute(t, authRegisterCmd, params, false, "")
utils.Execute(t, keysAddCmd, params, false, "")
}
func cookieTest(t *testing.T, params *utils.DeisTestConfig) {
// Regression test for https://github.com/deis/deis/pull/1136
// Ensure that cookies are cleared on auth:register and auth:cancel
user, err := user.Current()
if err != nil {
t.Fatal(err)
}
cookieJar := user.HomeDir + "/.deis/cookies.txt"
utils.Execute(t, authRegisterCmd, params, false, "")
cmd := "cat " + cookieJar
utils.CheckList(t, cmd, params, "csrftoken", false)
utils.CheckList(t, cmd, params, "sessionid", false)
info, err := os.Stat(cookieJar)
if err != nil {
t.Fatal(err)
}
mode := info.Mode().String()
expected := "-rw-------"
if mode != expected {
t.Fatalf("%s has wrong mode:\n current: %s\n expected: %s",
cookieJar, mode, expected)
}
utils.AuthCancel(t, params)
utils.CheckList(t, cmd, params, "csrftoken", true)
utils.CheckList(t, cmd, params, "sessionid", true)
}