Example #1
0
    def test_add_reviewer(self):
        # prep
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.assertTrue(rec.reviewed_by is None)

        # call
        rec.add_reviewer(self.reviewing_student)

        # check
        self.assertEqual(rec.reviewed_by, self.reviewing_student.id)
Example #2
0
    def test_is_under_review(self):
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.session.add(rec)
        self.session.commit()

        self.assertIsInstance(rec, ComplexStatusRecord)
        self.assertFalse(rec.is_under_review())

        rec.reviewed_by = self.reviewing_student.id
        self.assertTrue(rec.is_under_review())
Example #3
0
    def test_record_wait_notification(self):
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.assertTrue(rec.wait_notification_on is None)

        # call
        rec.record_wait_notification()

        # check
        self.assertIsInstance(rec.wait_notification_on, datetime.datetime)
        self.assertEqual(rec.wait_notification_on.tzinfo, pytz.utc,
                         "Timestamp is utc")
Example #4
0
    def test_record_sending_review_results(self):
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.assertTrue(rec.review_results_on is None)

        # call
        rec.record_sending_review_results()

        # check
        self.assertIsInstance(rec.review_results_on, datetime.datetime)
        self.assertEqual(rec.review_results_on.tzinfo, pytz.utc,
                         "Timestamp is utc")
Example #5
0
    def test_record_content_assignment_submission_no_date_provided(self):
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.assertTrue(rec.content_assignment_submitted is None)

        # call
        rec.record_content_assignment_submission()

        # check
        self.assertIsInstance(rec.content_assignment_submitted,
                              datetime.datetime)
        self.assertEqual(rec.content_assignment_submitted.tzinfo, pytz.utc,
                         "Timestamp is utc")
Example #6
0
    def test_add_reviewee(self):
        # prep
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.assertTrue(rec.reviewer_of is None)
        self.assertTrue(rec.reviewer_assigned_on is None)

        # call
        rec.add_reviewee(self.reviewed_student)

        # check
        self.assertIsInstance(rec.reviewer_assigned_on, datetime.datetime)
        self.assertEqual(rec.reviewer_of, self.reviewed_student.id)
Example #7
0
    def test_initial_record_creation(self):
        rec = ComplexStatusRecord(student_id=self.target_student.id,
                                  content_assignment_id=self.activity_id)
        self.session.add(rec)
        self.session.commit()

        self.assertIsInstance(rec, ComplexStatusRecord)

        # Check
        r = self.session.query( ComplexStatusRecord ) \
            .filter( ComplexStatusRecord.content_assignment_id == self.activity_id ) \
            .all()
        self.assertEqual(len(r), 1, "One record returned")
        self.assertEqual(r[0].student_id, self.target_student.id)
        self.assertEqual(r[0].content_assignment_id, self.activity_id)