use of org.mamute.model.User in project mamute by caelum.
the class UpdaterTest method should_be_pending_if_is_not_author.
@Test
public void should_be_pending_if_is_not_author() {
User user = user("chico", "chico@gmail.com", nextId());
QuestionInformation newInformation = new QuestionInformation("title", notMarked("description"), new LoggedUser(user, null));
UpdateStatus update = updater.update(myQuestion, newInformation);
assertEquals(UpdateStatus.PENDING, update);
assertTrue(myQuestion.getHistory().contains(newInformation));
}
use of org.mamute.model.User in project mamute by caelum.
the class FlagDaoTest method should_verify_that_user_flagged_comment.
@Test
public void should_verify_that_user_flagged_comment() {
FlagDao flags = new FlagDao(session);
User author = user("user user", "chico@brutal.com");
User other = user("user user", "other@brutal.com");
session.save(author);
session.save(other);
Comment commentFromAuthor = createCommentWithFlag(author);
Comment commentFromOther = createCommentWithFlag(other);
assertFalse(flags.alreadyFlagged(author, commentFromOther.getId(), Comment.class));
assertTrue(flags.alreadyFlagged(author, commentFromAuthor.getId(), Comment.class));
}
use of org.mamute.model.User in project mamute by caelum.
the class SignupValidatorTest method should_verify_empty_name.
@Test
public void should_verify_empty_name() throws Exception {
when(users.existsWithEmail(VALID_EMAIL)).thenReturn(false);
User user = user("", VALID_EMAIL);
boolean valid = signupValidator.validate(user, VALID_PASSWORD, VALID_PASSWORD);
assertFalse(valid);
}
use of org.mamute.model.User in project mamute by caelum.
the class SignupValidatorTest method should_verify_null_password.
@Test
public void should_verify_null_password() throws Exception {
User user = user(VALID_USER_NAME, VALID_EMAIL);
boolean valid = signupValidator.validate(user, null, null);
assertFalse(valid);
}
use of org.mamute.model.User in project mamute by caelum.
the class SignupValidatorTest method should_verify_passwords.
@Test
public void should_verify_passwords() throws Exception {
when(users.existsWithEmail(VALID_EMAIL)).thenReturn(false);
User user = user(VALID_USER_NAME, VALID_EMAIL);
boolean valid = signupValidator.validate(user, "123456", "1234567");
assertFalse(valid);
}
Aggregations