Skip to content

Commit 0421594

Browse files
author
Vaughn Dice
authored
Merge pull request #344 from vdice/interactive-register
feat(auth_test.go): add interactive register spec
2 parents f698215 + f7df62a commit 0421594

File tree

3 files changed

+57
-10
lines changed

3 files changed

+57
-10
lines changed

glide.lock

Lines changed: 16 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

glide.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ import:
55
subpackages:
66
- gbytes
77
- gexec
8+
- package: github.com/ThomasRooney/gexpect
89
- package: github.com/deis/controller-sdk-go

tests/auth_test.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package tests
22

33
import (
4+
"fmt"
5+
"os"
6+
47
"github.com/deis/workflow-e2e/tests/cmd"
58
"github.com/deis/workflow-e2e/tests/cmd/auth"
69
"github.com/deis/workflow-e2e/tests/model"
@@ -10,6 +13,7 @@ import (
1013
. "github.com/onsi/gomega"
1114
. "github.com/onsi/gomega/gbytes"
1215
. "github.com/onsi/gomega/gexec"
16+
gexpect "github.com/ThomasRooney/gexpect"
1317
)
1418

1519
var _ = Describe("deis auth", func() {
@@ -37,6 +41,42 @@ var _ = Describe("deis auth", func() {
3741

3842
})
3943

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+
4080
Context("with an existing user", func() {
4181

4282
var user model.User

0 commit comments

Comments
 (0)