Search in sources :

Example 31 with User

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));
}
Also used : User(org.mamute.model.User) LoggedUser(org.mamute.model.LoggedUser) UpdateStatus(org.mamute.model.UpdateStatus) LoggedUser(org.mamute.model.LoggedUser) QuestionInformation(org.mamute.model.QuestionInformation) Test(org.junit.Test)

Example 32 with User

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));
}
Also used : Comment(org.mamute.model.Comment) User(org.mamute.model.User) Test(org.junit.Test)

Example 33 with User

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);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Example 34 with User

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);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Example 35 with User

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);
}
Also used : User(org.mamute.model.User) Test(org.junit.Test)

Aggregations

User (org.mamute.model.User)97 Test (org.junit.Test)56 Question (org.mamute.model.Question)28 LoggedUser (org.mamute.model.LoggedUser)25 VRaptorTestResult (br.com.caelum.vraptor.test.VRaptorTestResult)9 UserFlow (br.com.caelum.vraptor.test.requestflow.UserFlow)9 Answer (org.mamute.model.Answer)9 LoginMethod (org.mamute.model.LoginMethod)9 Post (br.com.caelum.vraptor.Post)7 Before (org.junit.Before)7 Tag (org.mamute.model.Tag)7 QuestionInformation (org.mamute.model.QuestionInformation)6 Email (org.apache.commons.mail.Email)5 UserPersonalInfo (org.mamute.dto.UserPersonalInfo)5 ReputationEvent (org.mamute.model.ReputationEvent)5 ArrayList (java.util.ArrayList)4 Watcher (org.mamute.model.watch.Watcher)4 DateTime (org.joda.time.DateTime)3 Elements (org.jsoup.select.Elements)3 DaoManager (org.mamute.integration.util.DaoManager)3