1
1
package tests
2
2
3
3
import (
4
+ "fmt"
5
+ "os"
6
+
4
7
"github.com/deis/workflow-e2e/tests/cmd"
5
8
"github.com/deis/workflow-e2e/tests/cmd/auth"
6
9
"github.com/deis/workflow-e2e/tests/model"
@@ -10,6 +13,7 @@ import (
10
13
. "github.com/onsi/gomega"
11
14
. "github.com/onsi/gomega/gbytes"
12
15
. "github.com/onsi/gomega/gexec"
16
+ gexpect "github.com/ThomasRooney/gexpect"
13
17
)
14
18
15
19
var _ = Describe ("deis auth" , func () {
@@ -37,6 +41,42 @@ var _ = Describe("deis auth", func() {
37
41
38
42
})
39
43
44
+ Context ("with an existing user" , func () {
45
+
46
+ var user model.User
47
+
48
+ BeforeEach (func () {
49
+ user = model .NewUser ()
50
+ os .Setenv ("DEIS_PROFILE" , user .Username )
51
+ })
52
+
53
+ AfterEach (func () {
54
+ auth .Cancel (user )
55
+ os .Unsetenv ("DEIS_PROFILE" )
56
+ })
57
+
58
+ Specify ("that user can register in an interactive manner" , func () {
59
+ sess , err := gexpect .Spawn (fmt .Sprintf ("deis auth:register %s --password=%s" , settings .DeisControllerURL , user .Password ))
60
+ Expect (err ).NotTo (HaveOccurred ())
61
+
62
+ err = sess .Expect ("username:" )
63
+ Expect (err ).NotTo (HaveOccurred ())
64
+ sess .SendLine (user .Username )
65
+
66
+ err = sess .Expect ("email:" )
67
+ Expect (err ).NotTo (HaveOccurred ())
68
+ sess .SendLine (user .Email )
69
+
70
+ sess .Expect (fmt .Sprintf ("Registered %s" , user .Username ))
71
+ Expect (err ).NotTo (HaveOccurred ())
72
+
73
+ sess .Expect (fmt .Sprintf ("Logged in as %s" , user .Username ))
74
+ Expect (err ).NotTo (HaveOccurred ())
75
+
76
+ auth .Whoami (user )
77
+ })
78
+ })
79
+
40
80
Context ("with an existing user" , func () {
41
81
42
82
var user model.User
0 commit comments