-
Notifications
You must be signed in to change notification settings - Fork 112
Expand file tree
/
Copy pathauth_test.go
More file actions
53 lines (43 loc) · 1.33 KB
/
auth_test.go
File metadata and controls
53 lines (43 loc) · 1.33 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
52
53
// +build integration
package tests
import (
"fmt"
"testing"
"github.com/deis/deis/tests/integration-utils"
"github.com/deis/deis/tests/utils"
)
func authSetup(t *testing.T) *itutils.DeisTestConfig {
user := itutils.GetGlobalConfig()
user.UserName, user.Password = utils.GetUserDetails()
fmt.Println("username :" + user.UserName)
fmt.Println("password :" + user.Password)
return user
}
func authRegisterTest(t *testing.T, params *itutils.DeisTestConfig) {
cmd := itutils.GetCommand("auth", "register")
itutils.Execute(t, cmd, params, false, "")
itutils.Execute(t, cmd, params, true, "Registration failed")
}
func authLoginTest(t *testing.T, params *itutils.DeisTestConfig) {
cmd := itutils.GetCommand("auth", "login")
itutils.Execute(t, cmd, params, false, "")
params = authSetup(t)
itutils.Execute(t, cmd, params, true, "200 OK")
}
func authLogoutTest(t *testing.T, params *itutils.DeisTestConfig) {
cmd := itutils.GetCommand("auth", "logout")
itutils.Execute(t, cmd, params, false, "")
}
func authCancel(t *testing.T, params *itutils.DeisTestConfig) {
itutils.AuthCancel(t, params)
}
func teardown(t *testing.T, params *itutils.DeisTestConfig) {
authLogoutTest(t, params)
}
func TestAuth(t *testing.T) {
params := authSetup(t)
authRegisterTest(t, params)
authLogoutTest(t, params)
authLoginTest(t, params)
authCancel(t, params)
}