Ejemplo n.º 1
0
func TestMain(m *testing.M) {
	singleUser = *new(user)
	singleUser.username = random.Email()
	singleUser.password = random.Adjective() + random.Noun()
	singleUser.question1 = random.Adjective()
	singleUser.answer1 = random.Noun()
	singleUser.question2 = random.Adjective()
	singleUser.answer2 = random.Noun()
	singleUser.question3 = random.Adjective()
	singleUser.answer3 = random.Noun()
	InitLocalStorage()
	os.Exit(m.Run())

}
Ejemplo n.º 2
0
func TestChangeQuestions(t *testing.T) {
	singleUser.question1 = random.Adjective()
	singleUser.answer1 = random.Noun()
	singleUser.question2 = random.Adjective()
	singleUser.answer2 = random.Noun()
	singleUser.question3 = random.Adjective()
	singleUser.answer3 = random.Noun()
	err := ChangeQuestions(singleUser.username, singleUser.password, singleUser.question1,
		singleUser.question2, singleUser.question3, singleUser.answer1,
		singleUser.answer2, singleUser.answer3)
	if err != nil {
		t.Errorf("Question Change Failed: %s\n", err)
	}

}
Ejemplo n.º 3
0
func TestChangePassword(t *testing.T) {
	var err error
	newPassword := random.Adjective() + random.Noun()
	device, err = ChangePassword(singleUser.username, singleUser.password, newPassword)
	singleUser.password = newPassword
	if err != nil {
		t.Errorf("Password Change Failed: %s\n", err)
	}
	if len(device) == 0 {
		t.Errorf("Device File Creation Failed: %s\n", err)
	}
	t.Logf("Device File: %s\n", device)
}
Ejemplo n.º 4
0
func TestRecover(t *testing.T) {
	var err error
	newPassword := random.Adjective() + random.Noun()
	device, err = Recover(singleUser.username, newPassword, singleUser.answer1,
		singleUser.answer2, singleUser.answer3)
	if err != nil {
		t.Errorf("Recovery Failed: %s\n", err)
	}
	if len(device) == 0 {
		t.Errorf("Device File Creation Failed: %s\n", err)
	}
	t.Logf("Device File: %s\n", device)
	singleUser.password = newPassword
}