use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditAnswerRuleTest method moderator_should_be_allowed_to_edit.
@Test
public void moderator_should_be_allowed_to_edit() throws IOException {
LoggedUser loggedUser = loggedUser("moderator", "moderator@brutal.com", NOT_AUTHOR);
loggedUser.getCurrent().asModerator();
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
assertTrue(new EditAnswerRule(loggedUser, env).isAllowed(answer));
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditQuestionRuleTest method user_with_low_karma_should_not_be_allowed_to_edit.
@Test
public void user_with_low_karma_should_not_be_allowed_to_edit() throws IOException {
LoggedUser other = loggedUser("other", "other@brutal.com", 3l);
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
assertFalse(new EditQuestionRule(other, env).isAllowed(question));
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditAnswerRuleTest method loggedUser_with_low_karma_should_not_be_allowed_to_edit.
@Test
public void loggedUser_with_low_karma_should_not_be_allowed_to_edit() throws IOException {
LoggedUser other = loggedUser("other", "other@brutal.com", NOT_AUTHOR);
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
assertFalse(new EditAnswerRule(other, env).isAllowed(answer));
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditAnswerRuleTest method author_should_be_allowed_to_edit_moderatable.
@Test
public void author_should_be_allowed_to_edit_moderatable() throws IOException {
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
assertTrue(new EditAnswerRule(author, env).isAllowed(answer));
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditQuestionRuleTest method moderator_should_be_allowed_to_edit.
@Test
public void moderator_should_be_allowed_to_edit() throws IOException {
LoggedUser moderator = loggedUser("moderator", "moderator@brutal.com", 2l);
moderator.getCurrent().asModerator();
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
assertTrue(new EditQuestionRule(moderator, env).isAllowed(question));
}
Aggregations