Search in sources :

Example 56 with FeedbackQuestionAttributes

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

the class FeedbackQuestionsDbTest method createFeedbackQuestions.

private List<FeedbackQuestionAttributes> createFeedbackQuestions(int num) throws Exception {
    FeedbackQuestionAttributes fqa;
    List<FeedbackQuestionAttributes> returnVal = new ArrayList<>();
    for (int i = 1; i <= num; i++) {
        fqa = getNewFeedbackQuestionAttributes();
        fqa.questionNumber = i;
        // remove possibly conflicting entity from the database
        fqDb.deleteEntity(fqa);
        fqDb.createEntity(fqa);
        returnVal.add(fqa);
    }
    return returnVal;
}
Also used : ArrayList(java.util.ArrayList) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)

Example 57 with FeedbackQuestionAttributes

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

the class FeedbackQuestionsDbTest method testGetFeedbackQuestionsForGiverType.

@Test
public void testGetFeedbackQuestionsForGiverType() throws Exception {
    FeedbackQuestionAttributes fqa = getNewFeedbackQuestionAttributes();
    // remove possibly conflicting entity from the database
    fqDb.deleteEntity(fqa);
    int[] numOfQuestions = createNewQuestionsForDifferentRecipientTypes();
    ______TS("standard success case");
    List<FeedbackQuestionAttributes> questions = fqDb.getFeedbackQuestionsForGiverType(fqa.feedbackSessionName, fqa.courseId, FeedbackParticipantType.INSTRUCTORS);
    assertEquals(questions.size(), numOfQuestions[0]);
    questions = fqDb.getFeedbackQuestionsForGiverType(fqa.feedbackSessionName, fqa.courseId, FeedbackParticipantType.STUDENTS);
    assertEquals(questions.size(), numOfQuestions[1]);
    questions = fqDb.getFeedbackQuestionsForGiverType(fqa.feedbackSessionName, fqa.courseId, FeedbackParticipantType.SELF);
    assertEquals(questions.size(), numOfQuestions[2]);
    questions = fqDb.getFeedbackQuestionsForGiverType(fqa.feedbackSessionName, fqa.courseId, FeedbackParticipantType.TEAMS);
    assertEquals(questions.size(), numOfQuestions[3]);
    ______TS("null params");
    try {
        fqDb.getFeedbackQuestionsForGiverType(null, fqa.courseId, FeedbackParticipantType.STUDENTS);
        signalFailureToDetectException();
    } catch (AssertionError e) {
        AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
    }
    try {
        fqDb.getFeedbackQuestionsForGiverType(fqa.feedbackSessionName, null, FeedbackParticipantType.STUDENTS);
        signalFailureToDetectException();
    } catch (AssertionError e) {
        AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
    }
    try {
        fqDb.getFeedbackQuestionsForGiverType(fqa.feedbackSessionName, fqa.courseId, null);
        signalFailureToDetectException();
    } catch (AssertionError e) {
        AssertHelper.assertContains(Const.StatusCodes.DBLEVEL_NULL_INPUT, e.getLocalizedMessage());
    }
    ______TS("non-existant session");
    assertTrue(fqDb.getFeedbackQuestionsForGiverType("non-existant session", fqa.courseId, FeedbackParticipantType.STUDENTS).isEmpty());
    ______TS("no questions in session");
    assertTrue(fqDb.getFeedbackQuestionsForGiverType("Empty session", fqa.courseId, FeedbackParticipantType.STUDENTS).isEmpty());
    deleteFeedbackQuestions(numOfQuestions[0] + numOfQuestions[1] + numOfQuestions[2] + numOfQuestions[3]);
}
Also used : FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) Test(org.testng.annotations.Test)

Example 58 with FeedbackQuestionAttributes

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

the class InstructorFeedbackEditPageDataTest method allTests.

@Test
public void allTests() {
    ______TS("Typical case");
    // Setup
    InstructorFeedbackEditPageData data = new InstructorFeedbackEditPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken);
    FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1");
    List<FeedbackQuestionAttributes> questions = new ArrayList<>();
    questions.add(dataBundle.feedbackQuestions.get("qn1InSession1InCourse1"));
    questions.add(dataBundle.feedbackQuestions.get("qn2InSession1InCourse1"));
    questions.add(dataBundle.feedbackQuestions.get("qn3InSession1InCourse1"));
    Map<String, Boolean> questionHasResponses = new HashMap<>();
    questionHasResponses.put(dataBundle.feedbackQuestions.get("qn1InSession1InCourse1").getId(), true);
    List<StudentAttributes> studentList = new ArrayList<>();
    studentList.add(dataBundle.students.get("student1InCourse1"));
    List<InstructorAttributes> instructorList = new ArrayList<>();
    instructorList.add(dataBundle.instructors.get("instructor1OfCourse1"));
    InstructorAttributes instructor = getInstructorFromBundle("instructor1OfCourse1");
    CourseDetailsBundle courseDetails = new CourseDetailsBundle(dataBundle.courses.get("typicalCourse1"));
    data.init(fs, questions, questionHasResponses, studentList, instructorList, instructor, true, instructorList.size(), courseDetails);
    // Test fs form
    FeedbackSessionsForm fsForm = data.getFsForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_COPY_PAGE).withUserId(instructor.googleId).toString(), fsForm.getCopyToLink());
    assertEquals(fs.getCourseId(), fsForm.getCourseId());
    assertNull(fsForm.getCourses());
    assertNull(fsForm.getCoursesSelectField());
    assertFalse(fsForm.isFeedbackSessionTypeEditable());
    assertTrue(fsForm.isEditFsButtonsVisible());
    assertNull(fsForm.getFeedbackSessionTypeOptions());
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_SAVE).toString(), fsForm.getFormSubmitAction());
    assertEquals(data.getInstructorFeedbackDeleteLink(fs.getCourseId(), fs.getFeedbackSessionName(), Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE), fsForm.getFsDeleteLink());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getEndTimeLocal()), fsForm.getFsEndDate());
    assertEquals(fs.getFeedbackSessionName(), fsForm.getFsName());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getStartTimeLocal()), fsForm.getFsStartDate());
    assertEquals(SanitizationHelper.sanitizeForHtml(fs.getInstructions().getValue()), fsForm.getInstructions());
    assertEquals("Save Changes", fsForm.getSubmitButtonText());
    assertFalse(fsForm.isCourseIdEditable());
    assertFalse(fsForm.isShowNoCoursesMessage());
    assertFalse(fsForm.isSubmitButtonVisible());
    assertFalse(fsForm.isSubmitButtonDisabled());
    FeedbackSessionsAdditionalSettingsFormSegment additionalSettings = data.getFsForm().getAdditionalSettings();
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getResultsVisibleFromTimeLocal()), additionalSettings.getResponseVisibleDateValue());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getSessionVisibleFromTimeLocal()), additionalSettings.getSessionVisibleDateValue());
    assertFalse(additionalSettings.isResponseVisiblePublishManuallyChecked());
    assertTrue(additionalSettings.isResponseVisibleDateChecked());
    assertFalse(additionalSettings.isResponseVisibleImmediatelyChecked());
    assertFalse(additionalSettings.isResponseVisibleDateDisabled());
    assertFalse(additionalSettings.isSessionVisibleAtOpenChecked());
    assertFalse(additionalSettings.isSessionVisibleDateDisabled());
    assertTrue(additionalSettings.isSessionVisibleDateButtonChecked());
    assertFalse(additionalSettings.isSessionVisiblePrivateChecked());
    assertTrue(additionalSettings.isSendClosingEmailChecked());
    assertTrue(additionalSettings.isSendOpeningEmailChecked());
    assertTrue(additionalSettings.isSendPublishedEmailChecked());
    // test question edit forms
    List<FeedbackQuestionEditForm> questionForms = data.getQnForms();
    assertEquals(3, questionForms.size());
    assertEquals(Const.ActionURIs.INSTRUCTOR_FEEDBACK_QUESTION_EDIT, questionForms.get(0).getAction());
    assertEquals(fs.getCourseId(), questionForms.get(0).getCourseId());
    assertEquals(fs.getFeedbackSessionName(), questionForms.get(0).getFeedbackSessionName());
    String questionTextOfFirstQuestion = dataBundle.feedbackQuestions.get("qn1InSession1InCourse1").getQuestionDetails().getQuestionText();
    assertEquals(questionTextOfFirstQuestion, questionForms.get(0).getQuestionText());
    assertEquals(3, questionForms.get(0).getQuestionNumberOptions().size());
    assertEquals("What is the best selling point of your product?", questionForms.get(0).getQuestionText());
    FeedbackQuestionFeedbackPathSettings feedbackPath = questionForms.get(0).getFeedbackPathSettings();
    assertTrue(feedbackPath.isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(DEFAULT_NUM_ENTITIES_TO_GIVE_RESPONSES_TO, feedbackPath.getNumOfEntitiesToGiveFeedbackToValue());
    assertEquals(1, questionForms.get(0).getQuestionIndex());
    // Test visibility settings for the zero'th question form
    FeedbackQuestionVisibilitySettings visibilitySettings = questionForms.get(0).getVisibilitySettings();
    verifyMapContains(visibilitySettings.getResponseVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    verifyMapContains(visibilitySettings.getGiverNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    verifyMapContains(visibilitySettings.getRecipientNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    assertEquals("Rate 1 other student's product", questionForms.get(1).getQuestionText());
    assertTrue(questionForms.get(1).getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(DEFAULT_NUM_ENTITIES_TO_GIVE_RESPONSES_TO, questionForms.get(1).getFeedbackPathSettings().getNumOfEntitiesToGiveFeedbackToValue());
    verifyMapContains(questionForms.get(1).getVisibilitySettings().getResponseVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER));
    verifyMapContains(questionForms.get(1).getVisibilitySettings().getGiverNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS));
    verifyMapContains(questionForms.get(1).getVisibilitySettings().getRecipientNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER));
    assertEquals("My comments on the class", questionForms.get(2).getQuestionText());
    assertEquals(3, questionForms.get(2).getQuestionIndex());
    assertFalse(questionForms.get(2).getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(DEFAULT_NUM_ENTITIES_TO_GIVE_RESPONSES_TO, questionForms.get(2).getFeedbackPathSettings().getNumOfEntitiesToGiveFeedbackToValue());
    verifyMapContains(questionForms.get(2).getVisibilitySettings().getResponseVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.OWN_TEAM_MEMBERS));
    verifyMapContains(questionForms.get(2).getVisibilitySettings().getGiverNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.OWN_TEAM_MEMBERS));
    verifyMapContains(questionForms.get(2).getVisibilitySettings().getRecipientNameVisibleFor(), Arrays.asList(FeedbackParticipantType.INSTRUCTORS, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.OWN_TEAM_MEMBERS));
    // TODO test specific question edit form html after it is no longer html in java
    // test question add form
    FeedbackQuestionEditForm newQuestionForm = data.getNewQnForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    assertFalse(newQuestionForm.getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(-1, newQuestionForm.getQuestionIndex());
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    // preview form
    FeedbackSessionPreviewForm previewForm = data.getPreviewForm();
    assertEquals(1, previewForm.getStudentToPreviewAsOptions().size());
    assertEquals(1, previewForm.getInstructorToPreviewAsOptions().size());
    ______TS("empty feedback session");
    // setup
    data = new InstructorFeedbackEditPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken);
    fs = dataBundle.feedbackSessions.get("empty.session");
    fs.setPublishedEmailEnabled(false);
    fs.setClosingEmailEnabled(false);
    questions = new ArrayList<>();
    questionHasResponses = new HashMap<>();
    studentList = new ArrayList<>();
    instructorList = new ArrayList<>();
    instructor = getInstructorFromBundle("instructor1OfCourse1");
    courseDetails = new CourseDetailsBundle(dataBundle.courses.get("typicalCourse1"));
    data.init(fs, questions, questionHasResponses, studentList, instructorList, instructor, true, instructorList.size(), courseDetails);
    fsForm = data.getFsForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_COPY_PAGE).withUserId(instructor.googleId).toString(), fsForm.getCopyToLink());
    assertEquals(fs.getCourseId(), fsForm.getCourseId());
    assertNull(fsForm.getCourses());
    assertNull(fsForm.getCoursesSelectField());
    assertFalse(fsForm.isFeedbackSessionTypeEditable());
    assertTrue(fsForm.isEditFsButtonsVisible());
    assertNull(fsForm.getFeedbackSessionTypeOptions());
    additionalSettings = data.getFsForm().getAdditionalSettings();
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getResultsVisibleFromTimeLocal()), additionalSettings.getResponseVisibleDateValue());
    assertEquals(TimeHelper.formatDateForSessionsForm(fs.getSessionVisibleFromTimeLocal()), additionalSettings.getSessionVisibleDateValue());
    assertFalse(additionalSettings.isResponseVisiblePublishManuallyChecked());
    assertTrue(additionalSettings.isResponseVisibleDateChecked());
    assertFalse(additionalSettings.isResponseVisibleImmediatelyChecked());
    assertFalse(additionalSettings.isResponseVisibleDateDisabled());
    assertFalse(additionalSettings.isSessionVisibleAtOpenChecked());
    assertFalse(additionalSettings.isSessionVisibleDateDisabled());
    assertTrue(additionalSettings.isSessionVisibleDateButtonChecked());
    assertFalse(additionalSettings.isSessionVisiblePrivateChecked());
    assertFalse(additionalSettings.isSendClosingEmailChecked());
    assertTrue(additionalSettings.isSendOpeningEmailChecked());
    assertFalse(additionalSettings.isSendPublishedEmailChecked());
    questionForms = data.getQnForms();
    assertEquals(questions.size(), questionForms.size());
    previewForm = data.getPreviewForm();
    assertEquals(studentList.size(), previewForm.getStudentToPreviewAsOptions().size());
    assertEquals(instructorList.size(), previewForm.getInstructorToPreviewAsOptions().size());
    newQuestionForm = data.getNewQnForm();
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    assertFalse(newQuestionForm.getFeedbackPathSettings().isNumberOfEntitiesToGiveFeedbackToChecked());
    assertEquals(Config.getAppUrl(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE).withUserId(instructor.googleId).withCourseId(fs.getCourseId()).withSessionName(fs.getFeedbackSessionName()).toString(), newQuestionForm.getDoneEditingLink());
    ______TS("Resolved time fields map");
    data = new InstructorFeedbackEditPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken);
    assertNotNull("Should be empty map if unused", data.getResolvedTimeFields());
    assertTrue(data.getResolvedTimeFields().isEmpty());
    Map<String, String> expected = new HashMap<>();
    String startDate = "start date";
    String startTime = "start time";
    expected.put(Const.ParamsNames.FEEDBACK_SESSION_STARTDATE, startDate);
    expected.put(Const.ParamsNames.FEEDBACK_SESSION_STARTTIME, startTime);
    data.putResolvedTimeField(Const.ParamsNames.FEEDBACK_SESSION_STARTDATE, startDate);
    data.putResolvedTimeField(Const.ParamsNames.FEEDBACK_SESSION_STARTTIME, startTime);
    assertEquals(expected, data.getResolvedTimeFields());
}
Also used : InstructorFeedbackEditPageData(teammates.ui.pagedata.InstructorFeedbackEditPageData) FeedbackQuestionVisibilitySettings(teammates.ui.template.FeedbackQuestionVisibilitySettings) HashMap(java.util.HashMap) FeedbackSessionPreviewForm(teammates.ui.template.FeedbackSessionPreviewForm) ArrayList(java.util.ArrayList) FeedbackSessionsForm(teammates.ui.template.FeedbackSessionsForm) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) FeedbackQuestionFeedbackPathSettings(teammates.ui.template.FeedbackQuestionFeedbackPathSettings) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) FeedbackQuestionEditForm(teammates.ui.template.FeedbackQuestionEditForm) FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) CourseDetailsBundle(teammates.common.datatransfer.CourseDetailsBundle) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackSessionsAdditionalSettingsFormSegment(teammates.ui.template.FeedbackSessionsAdditionalSettingsFormSegment) Test(org.testng.annotations.Test)

Example 59 with FeedbackQuestionAttributes

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

the class InstructorFeedbackQuestionCopyPageDataTest method allTests.

@Test
public void allTests() {
    ______TS("Typical case");
    List<FeedbackQuestionAttributes> copiableQuestions = new ArrayList<>();
    copiableQuestions.addAll(dataBundle.feedbackQuestions.values());
    InstructorFeedbackQuestionCopyPageData data = new InstructorFeedbackQuestionCopyPageData(dataBundle.accounts.get("instructor1OfCourse1"), dummySessionToken, copiableQuestions);
    FeedbackQuestionCopyTable copyForm = data.getCopyQnForm();
    assertEquals(dataBundle.feedbackQuestions.size(), copyForm.getQuestionRows().size());
}
Also used : InstructorFeedbackQuestionCopyPageData(teammates.ui.pagedata.InstructorFeedbackQuestionCopyPageData) FeedbackQuestionCopyTable(teammates.ui.template.FeedbackQuestionCopyTable) ArrayList(java.util.ArrayList) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) Test(org.testng.annotations.Test)

Example 60 with FeedbackQuestionAttributes

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

the class BackDoorTest method testDeletion.

@Test
public void testDeletion() {
    // ----------deleting Instructor entities-------------------------
    InstructorAttributes instructor1OfCourse1 = dataBundle.instructors.get("instructor2OfCourse2");
    verifyPresentInDatastore(instructor1OfCourse1);
    String status = BackDoor.deleteInstructor(instructor1OfCourse1.courseId, instructor1OfCourse1.email);
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    verifyAbsentInDatastore(instructor1OfCourse1);
    // try to delete again: should indicate as success because delete fails silently.
    status = BackDoor.deleteInstructor(instructor1OfCourse1.email, instructor1OfCourse1.courseId);
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    // ----------deleting Feedback Response entities-------------------------
    FeedbackQuestionAttributes fq = dataBundle.feedbackQuestions.get("qn2InSession1InCourse1");
    FeedbackResponseAttributes fr = dataBundle.feedbackResponses.get("response1ForQ2S1C1");
    fq = BackDoor.getFeedbackQuestion(fq.courseId, fq.feedbackSessionName, fq.questionNumber);
    fr = BackDoor.getFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
    verifyPresentInDatastore(fr);
    status = BackDoor.deleteFeedbackResponse(fq.getId(), fr.giver, fr.recipient);
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    verifyAbsentInDatastore(fr);
    // ----------deleting Feedback Question entities-------------------------
    fq = dataBundle.feedbackQuestions.get("qn5InSession1InCourse1");
    verifyPresentInDatastore(fq);
    status = BackDoor.deleteFeedbackQuestion(fq.getId());
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    verifyAbsentInDatastore(fq);
    // ----------deleting Course entities-------------------------
    // #COURSE 2
    CourseAttributes course2 = dataBundle.courses.get("typicalCourse2");
    verifyPresentInDatastore(course2);
    status = BackDoor.deleteCourse(course2.getId());
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    verifyAbsentInDatastore(course2);
    // check if related student entities are also deleted
    StudentAttributes student2InCourse2 = dataBundle.students.get("student2InCourse2");
    verifyAbsentInDatastore(student2InCourse2);
    // #COURSE 1
    CourseAttributes course1 = dataBundle.courses.get("typicalCourse1");
    verifyPresentInDatastore(course1);
    status = BackDoor.deleteCourse(course1.getId());
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    verifyAbsentInDatastore(course1);
    // check if related student entities are also deleted
    StudentAttributes student1InCourse1 = dataBundle.students.get("student1InCourse1");
    verifyAbsentInDatastore(student1InCourse1);
    // #COURSE NO EVALS
    CourseAttributes courseNoEvals = dataBundle.courses.get("courseNoEvals");
    verifyPresentInDatastore(courseNoEvals);
    status = BackDoor.deleteCourse(courseNoEvals.getId());
    assertEquals(Const.StatusCodes.BACKDOOR_STATUS_SUCCESS, status);
    verifyAbsentInDatastore(courseNoEvals);
// ----------deleting Feedback Session entities-------------------------
// TODO: do proper deletion test
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes) Test(org.testng.annotations.Test)

Aggregations

FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)154 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)64 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)48 ArrayList (java.util.ArrayList)47 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)38 Test (org.testng.annotations.Test)35 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)25 List (java.util.List)23 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)23 FeedbackQuestionsDb (teammates.storage.api.FeedbackQuestionsDb)19 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)18 HashMap (java.util.HashMap)17 RedirectResult (teammates.ui.controller.RedirectResult)17 HashSet (java.util.HashSet)12 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)12 Text (com.google.appengine.api.datastore.Text)11 Map (java.util.Map)10 FeedbackQuestionDetails (teammates.common.datatransfer.questions.FeedbackQuestionDetails)10 LinkedHashMap (java.util.LinkedHashMap)9 DataBundle (teammates.common.datatransfer.DataBundle)9