Exemplo n.º 1
0
 def test_get_points(self):
     user = self.users[0]
     tutor = self.users[1]
     tutor.staff = True
     tutor.save()
     assert self.stack.get_points_earned(user) == 0
     elaboration = Elaboration(challenge=self.challenge, user=user, elaboration_text="test elaboration",
                               submission_time=datetime.now())
     elaboration.save()
     evaluation = Evaluation(submission=elaboration, tutor=tutor, evaluation_text="test_evaluation",
                             submission_time=datetime.now())
     for points in range(10):
         evaluation.evaluation_points = points
         evaluation.save()
         assert self.stack.get_points_earned(user) == points
Exemplo n.º 2
0
 def test_get_points(self):
     user = self.users[0]
     tutor = self.users[1]
     tutor.staff = True
     tutor.save()
     assert self.stack.get_points_earned(user) == 0
     elaboration = Elaboration(challenge=self.challenge,
                               user=user,
                               elaboration_text="test elaboration",
                               submission_time=datetime.now())
     elaboration.save()
     evaluation = Evaluation(submission=elaboration,
                             tutor=tutor,
                             evaluation_text="test_evaluation",
                             submission_time=datetime.now())
     for points in range(10):
         evaluation.evaluation_points = points
         evaluation.save()
         assert self.stack.get_points_earned(user) == points
Exemplo n.º 3
0
 def test_is_evaluated(self):
     user = self.users[0]
     tutor = self.users[1]
     tutor.staff = True
     tutor.save()
     assert self.stack.is_evaluated(user) is False
     elaboration = Elaboration(challenge=self.challenge, user=user, elaboration_text="test elaboration",
                               submission_time=datetime.now())
     elaboration.save()
     evaluation = Evaluation(submission=elaboration, tutor=tutor, evaluation_text="test_evaluation")
     evaluation.save()
     assert self.stack.is_evaluated(user) is False
     evaluation.submission_time = datetime.now()
     evaluation.evaluation_points = 10
     evaluation.save()
     assert self.stack.is_evaluated(user) is True
Exemplo n.º 4
0
 def test_is_evaluated(self):
     user = self.users[0]
     tutor = self.users[1]
     tutor.staff = True
     tutor.save()
     assert self.stack.is_evaluated(user) is False
     elaboration = Elaboration(challenge=self.challenge,
                               user=user,
                               elaboration_text="test elaboration",
                               submission_time=datetime.now())
     elaboration.save()
     evaluation = Evaluation(submission=elaboration,
                             tutor=tutor,
                             evaluation_text="test_evaluation")
     evaluation.save()
     assert self.stack.is_evaluated(user) is False
     evaluation.submission_time = datetime.now()
     evaluation.evaluation_points = 10
     evaluation.save()
     assert self.stack.is_evaluated(user) is True
Exemplo n.º 5
0
 def test_status_final_challenge(self):
     challenge1 = self.challenge
     self.create_challenge()
     challenge2 = self.challenge
     challenge2.prerequisite = challenge1
     challenge2.save()
     user1 = self.users[0]
     elaboration1 = Elaboration(challenge=challenge1,
                                user=user1,
                                elaboration_text="test",
                                submission_time=datetime.now())
     elaboration1.save()
     user2 = self.users[1]
     elaboration2 = Elaboration(challenge=challenge1,
                                user=user2,
                                elaboration_text="test",
                                submission_time=datetime.now())
     elaboration2.save()
     user3 = self.users[2]
     elaboration3 = Elaboration(challenge=challenge1,
                                user=user3,
                                elaboration_text="test",
                                submission_time=datetime.now())
     elaboration3.save()
     user4 = self.users[3]
     elaboration4 = Elaboration(challenge=challenge1,
                                user=user4,
                                elaboration_text="test",
                                submission_time=datetime.now())
     elaboration4.save()
     Review(elaboration=elaboration2,
            submission_time=datetime.now(),
            reviewer=user1,
            appraisal=Review.SUCCESS).save()
     Review(elaboration=elaboration3,
            submission_time=datetime.now(),
            reviewer=user1,
            appraisal=Review.SUCCESS).save()
     Review(elaboration=elaboration4,
            submission_time=datetime.now(),
            reviewer=user1,
            appraisal=Review.SUCCESS).save()
     assert challenge1.get_status(
         user1) == Challenge.DONE_MISSING_PEER_REVIEW
     assert challenge2.get_status(user1) == Challenge.NOT_ENABLED
     Review(elaboration=elaboration1,
            submission_time=datetime.now(),
            reviewer=user2,
            appraisal=Review.SUCCESS).save()
     Review(elaboration=elaboration1,
            submission_time=datetime.now(),
            reviewer=user3,
            appraisal=Review.SUCCESS).save()
     assert challenge1.get_status(user1) == Challenge.DONE_PEER_REVIEWED
     assert challenge2.get_status(user1) == Challenge.NOT_STARTED
     final_elaboration = Elaboration(challenge=challenge2,
                                     user=user1,
                                     elaboration_text="test",
                                     submission_time=datetime.now())
     final_elaboration.save()
     assert challenge2.get_status(user1) == Challenge.WAITING_FOR_EVALUATION
     tutor = user4
     tutor.staff = True
     tutor.save()
     Evaluation(submission=final_elaboration,
                tutor=tutor,
                evaluation_text="test evaluation",
                evaluation_points=10,
                submission_time=datetime.now()).save()
     assert challenge2.get_status(user1) == Challenge.EVALUATED