Search in sources :

Example 1 with DaoManager

use of org.mamute.integration.util.DaoManager in project mamute by caelum.

the class CommentQuestionTest method login.

@Before
public void login() {
    DaoManager manager = new DaoManager();
    User author = manager.randomUser();
    manager.createQuestion(author);
}
Also used : User(org.mamute.model.User) DaoManager(org.mamute.integration.util.DaoManager) Before(org.junit.Before)

Example 2 with DaoManager

use of org.mamute.integration.util.DaoManager in project mamute by caelum.

the class VoteUpDownTest method login.

@Before
public void login() {
    DaoManager manager = new DaoManager();
    User author = manager.randomUser();
    Question question = manager.createQuestion(author);
    manager.answerQuestion(author, question);
    loginWithALotOfKarma();
    questionPage = home().toFirstQuestionPage();
}
Also used : User(org.mamute.model.User) Question(org.mamute.model.Question) DaoManager(org.mamute.integration.util.DaoManager) Before(org.junit.Before)

Example 3 with DaoManager

use of org.mamute.integration.util.DaoManager in project mamute by caelum.

the class EditQuestionTest method should_touch_question.

@Test
public void should_touch_question() throws Exception {
    User user = new DaoManager().randomUser();
    Question question = createQuestionWithDao(user(user.getEmail()), "Question question question question question", "Description description description description description", tag("java"));
    UserFlow navigation = login(navigate(), user.getEmail());
    navigation = editQuestionWithFlow(navigation, question, "ASdoA sodi aosido iasod iOASIDoIASOdi", "asd oiasudo iausdoi uasoid uaosiduasoduoasi udaiosud oiasud oiasud oisa", "so diaos diaosi d", "java");
    VRaptorTestResult editedQuestion = navigation.followRedirect().execute();
    editedQuestion.wasStatus(200).isValid();
    Elements questionElements = getElementsByClass(editedQuestion.getResponseBody(), "edited-touch");
    Elements touchImage = getElementsByTag(questionElements.html(), "img");
    assertTrue(touchImage.isEmpty());
    navigation = login(navigate(), moderator().getEmail());
    navigation = editQuestionWithFlow(navigation, question, "Question question question question question", "Description description description description description", "new comment", "java");
    editedQuestion = navigation.followRedirect().execute();
    editedQuestion.wasStatus(200).isValid();
    questionElements = getElementsByClass(editedQuestion.getResponseBody(), "edited-touch");
    touchImage = getElementsByTag(questionElements.html(), "img");
    assertFalse(touchImage.isEmpty());
}
Also used : User(org.mamute.model.User) UserFlow(br.com.caelum.vraptor.test.requestflow.UserFlow) Question(org.mamute.model.Question) VRaptorTestResult(br.com.caelum.vraptor.test.VRaptorTestResult) Elements(org.jsoup.select.Elements) DaoManager(org.mamute.integration.util.DaoManager) Test(org.junit.Test)

Example 4 with DaoManager

use of org.mamute.integration.util.DaoManager in project mamute by caelum.

the class ForgotPasswordTest method setup.

@Before
public void setup() throws IOException {
    manager = new DaoManager();
    user = manager.randomUser();
    password = "newpass";
}
Also used : DaoManager(org.mamute.integration.util.DaoManager) Before(org.junit.Before)

Example 5 with DaoManager

use of org.mamute.integration.util.DaoManager in project mamute by caelum.

the class CommentAnswerTest method login.

@Before
public void login() {
    DaoManager manager = new DaoManager();
    User author = manager.randomUser();
    Question question = manager.createQuestion(author);
    manager.answerQuestion(author, question);
}
Also used : User(org.mamute.model.User) Question(org.mamute.model.Question) DaoManager(org.mamute.integration.util.DaoManager) Before(org.junit.Before)

Aggregations

DaoManager (org.mamute.integration.util.DaoManager)5 Before (org.junit.Before)4 User (org.mamute.model.User)4 Question (org.mamute.model.Question)3 VRaptorTestResult (br.com.caelum.vraptor.test.VRaptorTestResult)1 UserFlow (br.com.caelum.vraptor.test.requestflow.UserFlow)1 Elements (org.jsoup.select.Elements)1 Test (org.junit.Test)1