Search in sources :

Example 1 with AuthorRule

use of org.mamute.auth.rules.AuthorRule 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));
}
Also used : AuthorRule(org.mamute.auth.rules.AuthorRule) User(org.mamute.model.User) QuestionBuilder(org.mamute.builder.QuestionBuilder) Question(org.mamute.model.Question) Moderatable(org.mamute.model.interfaces.Moderatable) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AuthorRule (org.mamute.auth.rules.AuthorRule)1 QuestionBuilder (org.mamute.builder.QuestionBuilder)1 Question (org.mamute.model.Question)1 User (org.mamute.model.User)1 Moderatable (org.mamute.model.interfaces.Moderatable)1