Пример #1
0
 def setUp(self):
     super(SubmissionTest, self).setUp()
     self.reviewee_email = '*****@*****.**'
     self.unit_id = 'unit_id'
     self.reviewee = models.Student(key_name=self.reviewee_email)
     self.reviewee_key = self.reviewee.put()
     self.instance_id = 'this-instance'
     self.submission = student_work.Submission(
         reviewee_key=self.reviewee_key, unit_id=self.unit_id)
     self.submission_key = self.submission.put()
     self.submission_with_iid = student_work.Submission(
         reviewee_key=self.reviewee_key,
         unit_id=self.unit_id,
         instance_id=self.instance_id)
     self.submission_with_iid_key = self.submission_with_iid.put()
Пример #2
0
 def setUp(self):
     super(ReviewStepTest, self).setUp()
     self.reviewee_email = '*****@*****.**'
     self.reviewee_key = models.Student(key_name=self.reviewee_email).put()
     self.reviewer_email = '*****@*****.**'
     self.reviewer_key = models.Student(key_name=self.reviewer_email).put()
     self.unit_id = 'unit_id'
     self.submission_key = student_work.Submission(
         reviewee_key=self.reviewee_key, unit_id=self.unit_id).put()
     self.review_key = student_work.Review(reviewee_key=self.reviewee_key,
                                           reviewer_key=self.reviewer_key,
                                           unit_id=self.unit_id).put()
     self.review_summary_key = peer.ReviewSummary(
         reviewee_key=self.reviewee_key,
         submission_key=self.submission_key,
         unit_id=self.unit_id).put()
     self.step = peer.ReviewStep(assigner_kind=domain.ASSIGNER_KIND_AUTO,
                                 review_key=self.review_key,
                                 review_summary_key=self.review_summary_key,
                                 reviewee_key=self.reviewee_key,
                                 reviewer_key=self.reviewer_key,
                                 state=domain.REVIEW_STATE_ASSIGNED,
                                 submission_key=self.submission_key,
                                 unit_id=self.unit_id)
     self.step_key = self.step.put()
Пример #3
0
 def test_constructor_sets_key_name(self):
     """Tests construction of key_name, put of entity with key_name set."""
     unit_id = 'unit_id'
     reviewee_key = models.Student(key_name='*****@*****.**').put()
     review_key = student_work.Submission(reviewee_key=reviewee_key,
                                          unit_id=unit_id).put()
     self.assertEqual(
         student_work.Submission.key_name(unit_id, reviewee_key),
         review_key.name())
 def test_constructor_sets_key_name(self):
     unit_id = 'unit_id'
     reviewee_key = models.Student(key_name='*****@*****.**').put()
     submission_key = student_work.Submission(
         reviewee_key=reviewee_key, unit_id=unit_id).put()
     summary_key = peer.ReviewSummary(
         reviewee_key=reviewee_key, submission_key=submission_key,
         unit_id=unit_id).put()
     self.assertEqual(
         peer.ReviewSummary.key_name(submission_key), summary_key.name())
Пример #5
0
 def setUp(self):
     super(ReviewSummaryTest, self).setUp()
     self.unit_id = 'unit_id'
     self.reviewee_email = '*****@*****.**'
     self.reviewee_key = models.Student(
         key_name='*****@*****.**').put()
     self.submission_key = student_work.Submission(
         reviewee_key=self.reviewee_key, unit_id=self.unit_id).put()
     self.summary = peer.ReviewSummary(
         reviewee_key=self.reviewee_key, submission_key=self.submission_key,
         unit_id=self.unit_id)
     self.summary_key = self.summary.put()
 def test_constructor_sets_key_name(self):
     """Tests construction of key_name, put of entity with key_name set."""
     unit_id = 'unit_id'
     reviewee_key = models.Student(key_name='*****@*****.**').put()
     reviewer_key = models.Student(key_name='*****@*****.**').put()
     submission_key = student_work.Submission(
         reviewee_key=reviewee_key, unit_id=unit_id).put()
     step_key = peer.ReviewStep(
         assigner_kind=domain.ASSIGNER_KIND_AUTO,
         reviewee_key=reviewee_key, reviewer_key=reviewer_key,
         state=domain.REVIEW_STATE_ASSIGNED,
         submission_key=submission_key, unit_id=unit_id).put()
     self.assertEqual(
         peer.ReviewStep.key_name(submission_key, reviewer_key),
         step_key.name())
Пример #7
0
    def test_records_indexed_by_user_id_removed(self):
        """Test a sampling of types whose index is or contains the user ID."""
        user_id = None
        user = actions.login(self.STUDENT_EMAIL)
        actions.register(self, self.STUDENT_EMAIL, course=self.COURSE)

        # Get IDs of those students; make an event for each.
        with common_utils.Namespace(self.NAMESPACE):
            student = models.Student.get_by_user(user)
            user_id = student.user_id

            # Indexed by user ID suffixed with a string.
            p = models.StudentPropertyEntity.create(student, 'foo')
            p.value = 'foo'
            p.put()
            invitation.InvitationStudentProperty.load_or_default(student).put()
            questionnaire.StudentFormEntity.load_or_default(
                student, 'a_form').put()

            # User ID plus skill name.
            cm = competency.BaseCompetencyMeasure.load(user_id, 1)
            cm.save()

            # models.student_work.KeyProperty - a foreign key to Student.
            reviewee_key = db.Key.from_path(models.Student.kind(), user_id)
            reviewer_key = db.Key.from_path(models.Student.kind(), 'xyzzy')
            student_work.Review(contents='abcdef', reviewee_key=reviewee_key,
                                reviewer_key=reviewer_key, unit_id='7').put()
            submission_key = student_work.Submission(
                unit_id='7', reviewee_key=reviewee_key).put()
            peer.ReviewSummary(submission_key=submission_key,
                               reviewee_key=reviewee_key, unit_id='7').put()
            peer.ReviewStep(
                submission_key=submission_key, reviewee_key=reviewee_key,
                reviewer_key=reviewer_key, unit_id='7',
                state=domain.REVIEW_STATE_ASSIGNED,
                assigner_kind=domain.ASSIGNER_KIND_AUTO).put()

        # Assure ourselves that we have all of the items we just added.
        with common_utils.Namespace(self.NAMESPACE):
            l = list(models.StudentPropertyEntity.all().run())
            self.assertEquals(2, len(l))  # 'foo', 'linear-course-completion'
            l = list(invitation.InvitationStudentProperty.all().run())
            self.assertEquals(1, len(l))
            l = list(questionnaire.StudentFormEntity.all().run())
            self.assertEquals(1, len(l))
            l = list(competency.CompetencyMeasureEntity.all().run())
            self.assertEquals(1, len(l))
            l = list(student_work.Review.all().run())
            self.assertEquals(1, len(l))
            l = list(student_work.Submission.all().run())
            self.assertEquals(1, len(l))
            l = list(peer.ReviewSummary.all().run())
            self.assertEquals(1, len(l))
            l = list(peer.ReviewStep.all().run())
            self.assertEquals(1, len(l))


        self._unregister_and_request_data_removal(self.COURSE)
        self._complete_removal()

        # Assure ourselves that all added items are now gone.
        with common_utils.Namespace(self.NAMESPACE):
            l = list(models.StudentPropertyEntity.all().run())
            self.assertEquals(0, len(l))
            l = list(invitation.InvitationStudentProperty.all().run())
            self.assertEquals(0, len(l))
            l = list(questionnaire.StudentFormEntity.all().run())
            self.assertEquals(0, len(l))
            l = list(competency.CompetencyMeasureEntity.all().run())
            self.assertEquals(0, len(l))
            l = list(student_work.Review.all().run())
            self.assertEquals(0, len(l))
            l = list(student_work.Submission.all().run())
            self.assertEquals(0, len(l))
            l = list(peer.ReviewSummary.all().run())
            self.assertEquals(0, len(l))
            l = list(peer.ReviewStep.all().run())
            self.assertEquals(0, len(l))