Compare commits
2 Commits
2a1e48e5e8
...
94bf4ffaa6
Author | SHA1 | Date | |
---|---|---|---|
94bf4ffaa6 | |||
24380e1449 |
@ -25,7 +25,7 @@ func extractPublicKey(response []byte) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func TestUserRegistration(t *testing.T) {
|
||||
func TestAccountCreationSuccessful(t *testing.T) {
|
||||
en, fn := enginetest.TestEngine("session1234112")
|
||||
defer fn()
|
||||
ctx := context.Background()
|
||||
@ -58,36 +58,6 @@ func TestUserRegistration(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTerms(t *testing.T) {
|
||||
en, fn := enginetest.TestEngine("session1234112_a")
|
||||
defer fn()
|
||||
ctx := context.Background()
|
||||
sessions := testData
|
||||
|
||||
for _, session := range sessions {
|
||||
groups := driver.FilterGroupsByName(session.Groups, "account_creation_accept_terms")
|
||||
for _, group := range groups {
|
||||
for _, step := range group.Steps {
|
||||
_, err := en.Exec(ctx, []byte(step.Input))
|
||||
if err != nil {
|
||||
t.Fatalf("Test case '%s' failed during Exec: %v", group.Name, err)
|
||||
}
|
||||
|
||||
w := bytes.NewBuffer(nil)
|
||||
_, err = en.Flush(ctx, w)
|
||||
if err != nil {
|
||||
t.Fatalf("Test case '%s' failed during Flush: %v", group.Name, err)
|
||||
}
|
||||
b := w.Bytes()
|
||||
if !bytes.Equal(b, []byte(step.ExpectedContent)) {
|
||||
t.Fatalf("expected:\n\t%s\ngot:\n\t%s\n", step.ExpectedContent, b)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccountRegistrationRejectTerms(t *testing.T) {
|
||||
en, fn := enginetest.TestEngine("session1234112_b")
|
||||
defer fn()
|
||||
@ -119,37 +89,6 @@ func TestAccountRegistrationRejectTerms(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccountRegistrationInvalidPin(t *testing.T) {
|
||||
en, fn := enginetest.TestEngine("session1234112_c")
|
||||
defer fn()
|
||||
ctx := context.Background()
|
||||
sessions := testData
|
||||
for _, session := range sessions {
|
||||
groups := driver.FilterGroupsByName(session.Groups, "account_creation_invalid_pin")
|
||||
for _, group := range groups {
|
||||
for _, step := range group.Steps {
|
||||
cont, err := en.Exec(ctx, []byte(step.Input))
|
||||
if err != nil {
|
||||
t.Fatalf("Test case '%s' failed at input '%s': %v", group.Name, step.Input, err)
|
||||
return
|
||||
}
|
||||
if !cont {
|
||||
break
|
||||
}
|
||||
w := bytes.NewBuffer(nil)
|
||||
if _, err := en.Flush(ctx, w); err != nil {
|
||||
t.Fatalf("Test case '%s' failed during Flush: %v", group.Name, err)
|
||||
}
|
||||
|
||||
b := w.Bytes()
|
||||
if !bytes.Equal(b, []byte(step.ExpectedContent)) {
|
||||
t.Fatalf("expected:\n\t%s\ngot:\n\t%s\n", step.ExpectedContent, b)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendWithInvalidInputs(t *testing.T) {
|
||||
en, fn := enginetest.TestEngine("session1234112")
|
||||
defer fn()
|
||||
|
@ -1 +1 @@
|
||||
Enter a new four number PIN
|
||||
Enter a new four number PIN:
|
@ -4,66 +4,6 @@
|
||||
"groups": [
|
||||
{
|
||||
"name": "account_creation_successful",
|
||||
"steps": [
|
||||
{
|
||||
"input": "",
|
||||
"expectedContent": "Welcome to Sarafu Network\nPlease select a language\n0:english\n1:kiswahili"
|
||||
},
|
||||
{
|
||||
"input": "0",
|
||||
"expectedContent": "Do you agree to terms and conditions?\n0:yes\n1:no"
|
||||
},
|
||||
{
|
||||
"input": "0",
|
||||
"expectedContent": "Please enter a new four number PIN for your account:\n0:Exit"
|
||||
},
|
||||
{
|
||||
"input": "1234",
|
||||
"expectedContent": "Enter your four number PIN again:"
|
||||
},
|
||||
{
|
||||
"input": "1234",
|
||||
"expectedContent": "Your account is being created...Thank you for using Sarafu. Goodbye!"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "account_creation_accept_terms",
|
||||
"steps": [
|
||||
{
|
||||
"input": "",
|
||||
"expectedContent": "Welcome to Sarafu Network\nPlease select a language\n0:english\n1:kiswahili"
|
||||
},
|
||||
{
|
||||
"input": "0",
|
||||
"expectedContent": "Do you agree to terms and conditions?\n0:yes\n1:no"
|
||||
},
|
||||
{
|
||||
"input": "0",
|
||||
"expectedContent": "Please enter a new four number PIN for your account:\n0:Exit"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "account_creation_reject_terms",
|
||||
"steps": [
|
||||
{
|
||||
"input": "",
|
||||
"expectedContent": "Welcome to Sarafu Network\nPlease select a language\n0:english\n1:kiswahili"
|
||||
},
|
||||
{
|
||||
"input": "0",
|
||||
"expectedContent": "Do you agree to terms and conditions?\n0:yes\n1:no"
|
||||
},
|
||||
{
|
||||
"input": "1",
|
||||
"expectedContent": "Thank you for using Sarafu. Goodbye!"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "account_creation_invalid_pin",
|
||||
"steps": [
|
||||
{
|
||||
"input": "",
|
||||
@ -93,7 +33,23 @@
|
||||
"input": "1234",
|
||||
"expectedContent": "Your account is being created...Thank you for using Sarafu. Goodbye!"
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "account_creation_reject_terms",
|
||||
"steps": [
|
||||
{
|
||||
"input": "",
|
||||
"expectedContent": "Welcome to Sarafu Network\nPlease select a language\n0:english\n1:kiswahili"
|
||||
},
|
||||
{
|
||||
"input": "0",
|
||||
"expectedContent": "Do you agree to terms and conditions?\n0:yes\n1:no"
|
||||
},
|
||||
{
|
||||
"input": "1",
|
||||
"expectedContent": "Thank you for using Sarafu. Goodbye!"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user