use of br.com.caelum.vraptor.test.requestflow.UserFlow in project mamute by caelum.
the class ForgotPasswordTest method should_accept_recovery_for_existant_email.
@Test
public void should_accept_recovery_for_existant_email() {
UserFlow navigation = tryToSendResetPasswordEmail(user.getEmail());
VRaptorTestResult sentEmail = navigation.followRedirect().execute();
sentEmail.wasStatus(200).isValid();
List<String> errorsList = errorsList(sentEmail);
assertTrue(errorsList.isEmpty());
}
use of br.com.caelum.vraptor.test.requestflow.UserFlow in project mamute by caelum.
the class ForgotPasswordTest method resetPassword.
private VRaptorTestResult resetPassword() {
UserFlow sentEmailNavigate = tryToSendResetPasswordEmail(user.getEmail());
VRaptorTestResult sentEmail = sentEmailNavigate.followRedirect().execute();
sentEmail.wasStatus(200).isValid();
String urlFromPasswordToken = manager.getURLFromPasswordToken(user.getEmail());
UserFlow newPasswordNavigate = tryToSetNewPassword(password, urlFromPasswordToken);
VRaptorTestResult newPassword = newPasswordNavigate.followRedirect().execute();
newPassword.wasStatus(200).isValid();
return newPassword;
}
use of br.com.caelum.vraptor.test.requestflow.UserFlow in project mamute by caelum.
the class ForgotPasswordTest method should_loggin_for_reseted_password_user.
@Test
public void should_loggin_for_reseted_password_user() {
resetPassword();
UserFlow navigation3 = loginWithPassword(navigate(), user.getEmail(), password);
VRaptorTestResult loginResult = navigation3.followRedirect().execute();
loginResult.wasStatus(200).isValid();
LoggedUser loggedUser = loginResult.getObject("currentUser");
assertEquals(user.getEmail(), loggedUser.getCurrent().getEmail());
}
use of br.com.caelum.vraptor.test.requestflow.UserFlow in project mamute by caelum.
the class ListTest method should_list_unsolved_questions.
@Test
public void should_list_unsolved_questions() {
UserFlow navigation = unsolvedQuestions();
VRaptorTestResult unsolved = navigation.execute();
unsolved.wasStatus(200).isValid();
List<Question> questions = unsolved.getObject("questions");
boolean onlyUnsolved = true;
for (Question q : questions) {
if (q.getAnswersCount() != 0) {
onlyUnsolved = false;
break;
}
}
assertTrue(onlyUnsolved);
}
use of br.com.caelum.vraptor.test.requestflow.UserFlow in project mamute by caelum.
the class ListTest method should_list_by_tag.
@Test
public void should_list_by_tag() {
String tag = "java";
UserFlow navigation = tagList(tag);
VRaptorTestResult tagList = navigation.execute();
tagList.wasStatus(200).isValid();
List<Question> questions = tagList.getObject("questions");
boolean onlyTag = true;
for (Question q : questions) {
if (!q.getTagsAsString(" ").contains(tag)) {
onlyTag = false;
break;
}
}
assertTrue(onlyTag);
}
Aggregations