use of org.mamute.model.User in project mamute by caelum.
the class AuthorRuleTest method should_allow_moderatable_author.
@Test
public void should_allow_moderatable_author() {
AuthorRule<Moderatable> rule = new AuthorRule<>();
User author = user("author", "author@brutal.com", 1l);
User other = user("other", "other@brutal.com", 2l);
Question question = new QuestionBuilder().withAuthor(author).build();
assertFalse(rule.isAllowed(other, question));
assertTrue(rule.isAllowed(author, question));
}
use of org.mamute.model.User in project mamute by caelum.
the class MinimumKarmaRuleTest method should_disallow_user_with_low_karma.
@Test
public void should_disallow_user_with_low_karma() {
User noob = user("noob", "noob@brutal.com");
setKarma(noob, 1l);
assertFalse(rule.isAllowed(noob, null));
}
use of org.mamute.model.User in project mamute by caelum.
the class MinimumKarmaRuleTest method should_allow_user_with_enough_karma.
@Test
public void should_allow_user_with_enough_karma() {
User u = user("user with 10 karma", "karma@brutal.com");
setKarma(u, 10l);
assertTrue(rule.isAllowed(u, null));
}
use of org.mamute.model.User in project mamute by caelum.
the class IndexSyncJob method generateUser.
private InvisibleForUsersRule generateUser() {
User user = new User(fromTrustedText("System"), "system");
LoggedUser loggedUser = new LoggedUser(user, null);
return new InvisibleForUsersRule(loggedUser);
}
use of org.mamute.model.User in project mamute by caelum.
the class CommentTest method should_verify_that_user_flagged_a_comment.
@Test
public void should_verify_that_user_flagged_a_comment() {
User author = user("name", "email@email", 1l);
User other = user("other", "other@brutal.com", 2l);
User commentAuthor = user("name", "email@email", 1l);
Comment comment = comment(commentAuthor, "comment");
Flag flag = new Flag(FlagType.RUDE, author);
comment.add(flag);
assertTrue(comment.alreadyFlaggedBy(author));
assertFalse(comment.alreadyFlaggedBy(other));
}
Aggregations