-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathauth_test.go
More file actions
51 lines (42 loc) · 1.23 KB
/
auth_test.go
File metadata and controls
51 lines (42 loc) · 1.23 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
package verbose
import (
"fmt"
"github.com/deis/deis/tests/integration-utils"
"testing"
)
func authSetup(t *testing.T) *itutils.UserDetails {
cfg := itutils.GlobalSetup(t)
ucfg := itutils.SetUser()
fmt.Println("username :" + ucfg.UserName)
fmt.Println("password :" + ucfg.Password)
ucfg.HostName = cfg.HostName
return ucfg
}
func authRegisterTest(t *testing.T, params *itutils.UserDetails) {
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.UserDetails) {
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.UserDetails) {
cmd := itutils.GetCommand("auth", "logout")
itutils.Execute(t, cmd, params, false, "")
}
func authCancel() {
fmt.Println("gexpect implementation")
}
func teardown(t *testing.T, params *itutils.UserDetails) {
authLogoutTest(t, params)
}
func TestAuth(t *testing.T) {
params := authSetup(t)
authRegisterTest(t, params)
authLogoutTest(t, params)
authLoginTest(t, params)
teardown(t, params)
}