Search in sources :

Example 71 with FeedbackSessionAttributes

use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.

the class FeedbackSessionsDbTest method testGetFeedbackSessionsPossiblyNeedingClosedEmail.

private void testGetFeedbackSessionsPossiblyNeedingClosedEmail() {
    ______TS("standard success case");
    List<FeedbackSessionAttributes> fsaList = fsDb.getFeedbackSessionsPossiblyNeedingClosedEmail();
    assertEquals(7, fsaList.size());
    for (FeedbackSessionAttributes fsa : fsaList) {
        assertFalse(fsa.isSentClosedEmail());
        assertTrue(fsa.isClosingEmailEnabled());
    }
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes)

Example 72 with FeedbackSessionAttributes

use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.

the class FeedbackSessionsDbTest method testGetFeedbackSessions.

private void testGetFeedbackSessions() {
    ______TS("standard success case");
    FeedbackSessionAttributes expected = dataBundle.feedbackSessions.get("session1InCourse2");
    FeedbackSessionAttributes actual = fsDb.getFeedbackSession("idOfTypicalCourse2", "Private feedback session");
    assertEquals(expected.toString(), actual.toString());
    ______TS("non-existant session");
    assertNull(fsDb.getFeedbackSession("non-course", "Non-existant feedback session"));
    ______TS("null fsName");
    try {
        fsDb.getFeedbackSession("idOfTypicalCourse1", null);
        signalFailureToDetectException();
    } catch (AssertionError e) {
        AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
    }
    ______TS("null courseId");
    try {
        fsDb.getFeedbackSession(null, "First feedback session");
        signalFailureToDetectException();
    } catch (AssertionError e) {
        AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
    }
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes)

Example 73 with FeedbackSessionAttributes

use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.

the class FeedbackSessionsDbTest method testUpdateFeedbackSession.

@Test
public void testUpdateFeedbackSession() throws Exception {
    ______TS("null params");
    try {
        fsDb.updateFeedbackSession(null);
        signalFailureToDetectException();
    } catch (AssertionError e) {
        AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
    }
    ______TS("invalid feedback sesion attributes");
    FeedbackSessionAttributes invalidFs = getNewFeedbackSession();
    fsDb.deleteEntity(invalidFs);
    fsDb.createEntity(invalidFs);
    Instant afterEndTime = invalidFs.getEndTime().plus(Duration.ofDays(30));
    invalidFs.setStartTime(afterEndTime);
    invalidFs.setResultsVisibleFromTime(afterEndTime);
    try {
        fsDb.updateFeedbackSession(invalidFs);
        signalFailureToDetectException();
    } catch (InvalidParametersException e) {
        assertEquals(String.format(TIME_FRAME_ERROR_MESSAGE, SESSION_END_TIME_FIELD_NAME, SESSION_START_TIME_FIELD_NAME), e.getLocalizedMessage());
    }
    ______TS("feedback session does not exist");
    FeedbackSessionAttributes nonexistantFs = getNewFeedbackSession();
    nonexistantFs.setFeedbackSessionName("non existant fs");
    nonexistantFs.setCourseId("non.existant.course");
    try {
        fsDb.updateFeedbackSession(nonexistantFs);
        signalFailureToDetectException();
    } catch (EntityDoesNotExistException e) {
        AssertHelper.assertContains(FeedbackSessionsDb.ERROR_UPDATE_NON_EXISTENT, e.getLocalizedMessage());
    }
    ______TS("standard success case");
    FeedbackSessionAttributes modifiedSession = getNewFeedbackSession();
    fsDb.deleteEntity(modifiedSession);
    fsDb.createEntity(modifiedSession);
    verifyPresentInDatastore(modifiedSession);
    modifiedSession.setInstructions(new Text("new instructions"));
    modifiedSession.setGracePeriodMinutes(0);
    modifiedSession.setSentOpenEmail(false);
    fsDb.updateFeedbackSession(modifiedSession);
    verifyPresentInDatastore(modifiedSession);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) Instant(java.time.Instant) InvalidParametersException(teammates.common.exception.InvalidParametersException) Text(com.google.appengine.api.datastore.Text) EntityDoesNotExistException(teammates.common.exception.EntityDoesNotExistException) Test(org.testng.annotations.Test)

Example 74 with FeedbackSessionAttributes

use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.

the class FeedbackSessionsDbTest method testGetFeedbackSessionsPossiblyNeedingClosingEmail.

private void testGetFeedbackSessionsPossiblyNeedingClosingEmail() {
    ______TS("standard success case");
    List<FeedbackSessionAttributes> fsaList = fsDb.getFeedbackSessionsPossiblyNeedingClosingEmail();
    assertEquals(7, fsaList.size());
    for (FeedbackSessionAttributes fsa : fsaList) {
        assertFalse(fsa.isSentClosingEmail());
        assertTrue(fsa.isClosingEmailEnabled());
    }
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes)

Example 75 with FeedbackSessionAttributes

use of teammates.common.datatransfer.attributes.FeedbackSessionAttributes in project teammates by TEAMMATES.

the class FeedbackSessionsDbTest method testGetFeedbackSessionsPossiblyNeedingPublishedEmail.

private void testGetFeedbackSessionsPossiblyNeedingPublishedEmail() {
    ______TS("standard success case");
    List<FeedbackSessionAttributes> fsaList = fsDb.getFeedbackSessionsPossiblyNeedingPublishedEmail();
    assertEquals(9, fsaList.size());
    for (FeedbackSessionAttributes fsa : fsaList) {
        assertFalse(fsa.isSentPublishedEmail());
        assertTrue(fsa.isPublishedEmailEnabled());
    }
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes)

Aggregations

FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)205 Test (org.testng.annotations.Test)85 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)78 ArrayList (java.util.ArrayList)47 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)35 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)32 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)30 RedirectResult (teammates.ui.controller.RedirectResult)27 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)21 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)19 StatusMessage (teammates.common.util.StatusMessage)19 HashMap (java.util.HashMap)17 InvalidParametersException (teammates.common.exception.InvalidParametersException)14 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)13 EmailWrapper (teammates.common.util.EmailWrapper)12 Text (com.google.appengine.api.datastore.Text)11 DataBundle (teammates.common.datatransfer.DataBundle)11 EmailGenerator (teammates.logic.api.EmailGenerator)10 List (java.util.List)9 TaskWrapper (teammates.common.util.TaskWrapper)9