diff --git a/menu_traversal_test.go b/menu_traversal_test.go index b200322..3bf88fd 100644 --- a/menu_traversal_test.go +++ b/menu_traversal_test.go @@ -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() diff --git a/services/registration/new_pin b/services/registration/new_pin index c2d654e..30536ea 100644 --- a/services/registration/new_pin +++ b/services/registration/new_pin @@ -1 +1 @@ -Enter a new four number PIN \ No newline at end of file +Enter a new four number PIN: \ No newline at end of file diff --git a/services/registration/new_pin_swa b/services/registration/new_pin_swa index a2dc212..a0e087c 100644 --- a/services/registration/new_pin_swa +++ b/services/registration/new_pin_swa @@ -1 +1 @@ -Weka PIN mpya ya nne nambari: \ No newline at end of file +Weka PIN mpya ya nne nambari: \ No newline at end of file diff --git a/test_data.json b/test_data.json index 737d40f..6b8c678 100644 --- a/test_data.json +++ b/test_data.json @@ -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!" + } ] }, {