use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditQuestionRuleTest 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 EditQuestionRule(author, env).isAllowed(question));
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class EditQuestionRuleTest method user_with_enough_karma_should_be_allowed_to_edit.
@Test
public void user_with_enough_karma_should_be_allowed_to_edit() throws IOException {
LoggedUser userWithEnoughKarma = loggedUser("user", "user@brutal.com", 2l);
userWithEnoughKarma.getCurrent().increaseKarma(20);
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
assertTrue(new EditQuestionRule(userWithEnoughKarma, env).isAllowed(question));
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class QuestionTest method setup.
@Before
public void setup() throws IOException {
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
this.updater = new Updater(env);
}
use of org.mamute.brutauth.auth.rules.EnvironmentKarma in project mamute by caelum.
the class UserTest method moderator_should_approve_answer_information.
@Test
public void moderator_should_approve_answer_information() throws Exception {
Answer answer = answer("answer description", myQuestion, author);
AnswerInformation approvedInfo = answerInformation("new description", otherUser, answer);
ServletContext ctx = mock(ServletContext.class);
EnvironmentKarma env = new EnvironmentKarma(new MamuteEnvironment(ctx));
moderator.approve(answer, approvedInfo, env);
assertEquals(approvedInfo, answer.getInformation());
assertTrue(answer.getInformation().isModerated());
}
Aggregations