def test_opinionated_slash_confused_reviewer(self): staff = StaffFactory() submission = ApplicationSubmissionFactory() review_one = ReviewFactory(submission=submission) review_two = ReviewFactory(submission=submission) ReviewOpinionFactory(opinion_disagree=True, review=review_one, author__reviewer=staff) ReviewOpinionFactory(opinion_agree=True, review=review_two, author__reviewer=staff) qs = ApplicationSubmission.objects.for_table(user=staff) submission = qs[0] self.assertEqual(submission.opinion_disagree, 1) self.assertEqual(submission.review_count, 3) # Reviewers that disagree are not counted self.assertEqual(submission.review_submitted_count, 3) self.assertEqual(submission.review_recommendation, MAYBE)
def test_dont_double_count_review_and_opinion(self): staff = StaffFactory() submission = ApplicationSubmissionFactory() review = ReviewFactory(submission=submission, author__reviewer=staff, author__staff=True) opinion = ReviewOpinionFactory(opinion_disagree=True, review=review) # Another pair of review/opinion review_two = ReviewFactory(author=opinion.author, submission=submission) ReviewOpinionFactory(opinion_disagree=True, author__reviewer=staff, author__staff=True, review=review_two) qs = ApplicationSubmission.objects.for_table(user=staff) submission = qs[0] self.assertEqual(submission.opinion_disagree, 2) self.assertEqual(submission.review_count, 2) self.assertEqual(submission.review_submitted_count, 2) self.assertEqual(submission.review_recommendation, MAYBE)
def test_disagree_review_is_maybe(self): staff = StaffFactory() submission = ApplicationSubmissionFactory() review = ReviewFactory(submission=submission) ReviewOpinionFactory(opinion_disagree=True, review=review) qs = ApplicationSubmission.objects.for_table(user=staff) submission = qs[0] self.assertEqual(submission.opinion_disagree, 1) self.assertEqual(submission.review_count, 2) # Reviewers that disagree are not counted self.assertEqual(submission.review_submitted_count, 1) self.assertEqual(submission.review_recommendation, MAYBE)
def test_waiting_for_review_after_agreement_is_empty(self): staff = StaffFactory() submission = ApplicationSubmissionFactory(status='external_review', workflow_stages=2, reviewers=[staff, self.user]) review = ReviewFactory(submission=submission, author__reviewer=staff, author__staff=True, recommendation_yes=True) ReviewOpinionFactory(review=review, author__reviewer=self.user, opinion_agree=True) response = self.get_page() self.assertContains(response, 'Waiting for your review') self.assertContains(response, "Nice! You're all caught up.") self.assertEquals(response.context['awaiting_reviews']['count'], 0)
def test_submissions_dont_conflict(self): staff = StaffFactory() submission_one = ApplicationSubmissionFactory() submission_two = ApplicationSubmissionFactory() review_one = ReviewFactory(submission=submission_one) ReviewOpinionFactory(opinion_disagree=True, review=review_one) ReviewFactory(submission=submission_two) qs = ApplicationSubmission.objects.order_by('pk').for_table(user=staff) submission = qs[0] self.assertEqual(submission, submission_one) self.assertEqual(submission.opinion_disagree, 1) self.assertEqual(submission.review_count, 2) # Reviewers that disagree are not counted self.assertEqual(submission.review_submitted_count, 1) self.assertEqual(submission.review_recommendation, MAYBE) submission = qs[1] self.assertEqual(submission, submission_two) self.assertEqual(submission.opinion_disagree, None) self.assertEqual(submission.review_count, 1) self.assertEqual(submission.review_submitted_count, 1) self.assertEqual(submission.review_recommendation, NO)