Search in sources :

Example 1 with FeedbackSessionPublishedRemindersAction

use of teammates.ui.automated.FeedbackSessionPublishedRemindersAction in project teammates by TEAMMATES.

the class FeedbackSessionPublishedRemindersActionTest method allTests.

@Test
public void allTests() throws Exception {
    ______TS("default state of typical data bundle: 1 session published with email unsent");
    FeedbackSessionPublishedRemindersAction action = getAction();
    action.execute();
    verifySpecifiedTasksAdded(action, Const.TaskQueue.FEEDBACK_SESSION_PUBLISHED_EMAIL_QUEUE_NAME, 1);
    ______TS("1 session published by moving automated publish time, " + "1 session published similarly with disabled published reminder, " + "1 session published manually");
    // Publish session by moving automated publish time
    FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1");
    session1.setResultsVisibleFromTime(TimeHelper.getInstantDaysOffsetFromNow(-1));
    fsLogic.updateFeedbackSession(session1);
    verifyPresentInDatastore(session1);
    // Publish session by moving automated publish time and disable publish reminder
    FeedbackSessionAttributes session2 = dataBundle.feedbackSessions.get("session2InCourse1");
    session2.setResultsVisibleFromTime(TimeHelper.getInstantDaysOffsetFromNow(-1));
    session2.setPublishedEmailEnabled(false);
    fsLogic.updateFeedbackSession(session2);
    verifyPresentInDatastore(session2);
    // Do a manual publish
    FeedbackSessionAttributes session3 = dataBundle.feedbackSessions.get("gracePeriodSession");
    session3.setResultsVisibleFromTime(Const.TIME_REPRESENTS_LATER);
    fsLogic.updateFeedbackSession(session3);
    fsLogic.publishFeedbackSession(session3);
    verifyPresentInDatastore(session3);
    action = getAction();
    action.execute();
    verifySpecifiedTasksAdded(action, Const.TaskQueue.FEEDBACK_SESSION_PUBLISHED_EMAIL_QUEUE_NAME, 3);
    ______TS("1 session unpublished manually");
    fsLogic.unpublishFeedbackSession(session3);
    action = getAction();
    action.execute();
    verifySpecifiedTasksAdded(action, Const.TaskQueue.FEEDBACK_SESSION_PUBLISHED_EMAIL_QUEUE_NAME, 2);
    ______TS("1 session published with emails sent");
    session1.setSentPublishedEmail(true);
    fsLogic.updateFeedbackSession(session1);
    action = getAction();
    action.execute();
    verifySpecifiedTasksAdded(action, Const.TaskQueue.FEEDBACK_SESSION_PUBLISHED_EMAIL_QUEUE_NAME, 1);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackSessionPublishedRemindersAction(teammates.ui.automated.FeedbackSessionPublishedRemindersAction) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)1 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)1 FeedbackSessionPublishedRemindersAction (teammates.ui.automated.FeedbackSessionPublishedRemindersAction)1