Compare commits
	
		
			2 Commits
		
	
	
		
			cf5b4ec744
			...
			9eb35ec52d
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 9eb35ec52d | |||
| be165e5033 | 
@ -78,3 +78,59 @@ func TestTerms(t *testing.T) {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestAccountRegistrationRejectTerms(t *testing.T) {
 | 
			
		||||
	en, _ := enginetest.TestEngine("session1234112")
 | 
			
		||||
	defer en.Finish()
 | 
			
		||||
	var err error
 | 
			
		||||
	ctx := context.Background()
 | 
			
		||||
	sessions := testData
 | 
			
		||||
	for _, session := range sessions {
 | 
			
		||||
		groups := driver.FilterGroupsByName(session.Groups, "account_creation_reject_terms")
 | 
			
		||||
		for _, group := range groups {
 | 
			
		||||
			for _, step := range group.Steps {
 | 
			
		||||
				cont, _ := en.Exec(ctx, []byte(step.Input))
 | 
			
		||||
				if cont {
 | 
			
		||||
					w := bytes.NewBuffer(nil)
 | 
			
		||||
					_, err = en.Flush(ctx, w)
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						t.Fatal(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 TestAccountRegistrationInvalidPin(t *testing.T) {
 | 
			
		||||
	en, _ := enginetest.TestEngine("session1234112")
 | 
			
		||||
	defer en.Finish()
 | 
			
		||||
	var err error
 | 
			
		||||
	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, _ := en.Exec(ctx, []byte(step.Input))
 | 
			
		||||
				if cont {
 | 
			
		||||
					w := bytes.NewBuffer(nil)
 | 
			
		||||
					_, err = en.Flush(ctx, w)
 | 
			
		||||
					if err != nil {
 | 
			
		||||
						t.Fatal(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)
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "input": "1234",
 | 
			
		||||
                       "expectedContent": "Enter your four number PIN again:"
 | 
			
		||||
                       "expectedContent": "Your account is being created...Thank you for using Sarafu. Goodbye!"
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
@ -43,6 +43,57 @@
 | 
			
		||||
                       "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": "",
 | 
			
		||||
                       "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": "1111",
 | 
			
		||||
                       "expectedContent": "The PIN is not a match. Try again\n1:retry\n9:Quit"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "input": "1",
 | 
			
		||||
                       "expectedContent": "Enter your four number PIN again:"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "input": "1234",
 | 
			
		||||
                       "expectedContent": "Your account is being created...Thank you for using Sarafu. Goodbye!"
 | 
			
		||||
                    }
 | 
			
		||||
                   
 | 
			
		||||
                ]
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user