Compare commits
No commits in common. "94bf4ffaa6690307bcb9015e1afacdc9d51fee47" and "2a1e48e5e8ccc2b8d6b9d1e145deb78699fe4cd2" have entirely different histories.
94bf4ffaa6
...
2a1e48e5e8
@ -25,7 +25,7 @@ func extractPublicKey(response []byte) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAccountCreationSuccessful(t *testing.T) {
|
func TestUserRegistration(t *testing.T) {
|
||||||
en, fn := enginetest.TestEngine("session1234112")
|
en, fn := enginetest.TestEngine("session1234112")
|
||||||
defer fn()
|
defer fn()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@ -58,6 +58,36 @@ func TestAccountCreationSuccessful(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) {
|
func TestAccountRegistrationRejectTerms(t *testing.T) {
|
||||||
en, fn := enginetest.TestEngine("session1234112_b")
|
en, fn := enginetest.TestEngine("session1234112_b")
|
||||||
defer fn()
|
defer fn()
|
||||||
@ -89,6 +119,37 @@ 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) {
|
func TestSendWithInvalidInputs(t *testing.T) {
|
||||||
en, fn := enginetest.TestEngine("session1234112")
|
en, fn := enginetest.TestEngine("session1234112")
|
||||||
defer fn()
|
defer fn()
|
||||||
|
@ -1 +1 @@
|
|||||||
Enter a new four number PIN:
|
Enter a new four number PIN
|
@ -1 +1 @@
|
|||||||
Weka PIN mpya ya nne nambari:
|
Weka PIN mpya ya nne nambari:
|
@ -4,6 +4,66 @@
|
|||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"name": "account_creation_successful",
|
"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": [
|
"steps": [
|
||||||
{
|
{
|
||||||
"input": "",
|
"input": "",
|
||||||
@ -33,23 +93,7 @@
|
|||||||
"input": "1234",
|
"input": "1234",
|
||||||
"expectedContent": "Your account is being created...Thank you for using Sarafu. Goodbye!"
|
"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