use of org.mamute.model.LoggedUser in project mamute by caelum.
the class AuthTest method should_not_log_in_with_invalid_user.
@Test
public void should_not_log_in_with_invalid_user() {
UserFlow navigation = login(navigate(), "invalidEmail");
VRaptorTestResult loginResult = navigation.followRedirect().execute();
loginResult.wasStatus(200).isValid();
LoggedUser loggedUser = loginResult.getObject("currentUser");
User currentUser = loggedUser.getCurrent();
assertThat(currentUser, equalTo(User.GHOST));
}
use of org.mamute.model.LoggedUser in project mamute by caelum.
the class VoteDAOTest method beforeTest.
@Before
public void beforeTest() {
votes = new VoteDAO(session);
currentUser = user("Current User", "currentUser@email.com");
otherUser = user("Other User", "otherUser@email.com");
session.save(otherUser);
session.save(currentUser);
tags.add(tag("bla"));
for (Tag tag : tags) {
session.save(tag);
}
InvisibleForUsersRule invisibleRule = new InvisibleForUsersRule(new LoggedUser(currentUser, null));
votingMachine = new VotingMachine(votes, new KarmaCalculator(), new ReputationEventDAO(session, invisibleRule), new MassiveVote(), new RetrieveKarmaDownvote());
}
use of org.mamute.model.LoggedUser in project mamute by caelum.
the class WatcherDAOTest method set_up.
@Before
public void set_up() {
User leo = user("Leonardo", "leo@leo.com");
session.save(leo);
Tag java = tag("java");
session.save(java);
question = question(leo, java);
session.save(question);
watchers = new WatcherDAO(session, new InvisibleForUsersRule(new LoggedUser(leo, null)));
}
use of org.mamute.model.LoggedUser 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));
}
use of org.mamute.model.LoggedUser in project mamute by caelum.
the class InformationDAOTest method setup.
@Before
public void setup() {
author = user("namename", "email@gmail.com");
currentAuthor = new LoggedUser(author, null);
java = new Tag("java", "", null);
session.save(author);
session.save(java);
informations = new InformationDAO(session);
question = newQuestion(author);
}
Aggregations