Example #1
0
    def test_message_created_if_determination_exists(self):
        submissions = ApplicationSubmissionFactory.create_batch(2)

        DeterminationFactory(submission=submissions[0],
                             accepted=True,
                             is_draft=False)

        url = self.url(None) + '?submissions=' + ','.join(
            [str(submission.id)
             for submission in submissions]) + '&action=rejected'
        data = {
            'submissions': [submission.id for submission in submissions],
            'data': 'some data',
            'outcome': REJECTED,
            'message': 'Sorry',
            'author': self.user.id,
        }

        response = self.client.post(url, data, secure=True, follow=True)

        self.assertEqual(submissions[0].determinations.count(), 1)
        self.assertEqual(submissions[0].determinations.first().outcome,
                         ACCEPTED)

        self.assertEqual(submissions[1].determinations.count(), 1)
        self.assertEqual(submissions[1].determinations.first().outcome,
                         REJECTED)

        # 5 base - 2 x django messages, 1 x activity feed, 1 x email, 1 x slack
        # plus 1 extra for unable to determine
        self.assertEqual(len(response.context['messages']), 6)
Example #2
0
    def test_doesnt_confuse_lab_and_round(self):
        round = RoundFactory()
        lab = LabFactory()

        # Lab 50% progress
        LabSubmissionFactory(page=lab)
        LabSubmissionFactory(page=lab, rejected=True)

        # Round 0% progress
        ApplicationSubmissionFactory.create_batch(2, round=round)

        fetched_lab = RoundsAndLabs.objects.with_progress().last()
        fetched_round = RoundsAndLabs.objects.with_progress().first()

        self.assertEqual([fetched_round, fetched_lab], [round, lab])

        self.assertEqual(fetched_round.progress, 0)
        self.assertEqual(fetched_lab.progress, 50)
Example #3
0
    def test_can_progress_multiple_applications(self):
        submissions = ApplicationSubmissionFactory.create_batch(3)
        action = 'open-review'
        self.post_page(data=self.data(action, submissions))

        self.assertCountEqual(
            [self.refresh(submission).status for submission in submissions],
            ['internal_review'] * 3,
        )
Example #4
0
    def test_can_submit_batch_determination(self):
        submissions = ApplicationSubmissionFactory.create_batch(4)

        url = self.url(None) + '?submissions=' + ','.join(
            [str(submission.id)
             for submission in submissions]) + '&action=rejected'
        data = {
            'submissions': [submission.id for submission in submissions],
            'data': 'some data',
            'outcome': REJECTED,
            'message': 'Sorry',
            'author': self.user.id,
        }

        response = self.client.post(url, data, secure=True, follow=True)

        for submission in submissions:
            submission = self.refresh(submission)
            self.assertEqual(submission.status, 'rejected')
            self.assertEqual(submission.determinations.count(), 1)

        self.assertRedirects(response,
                             self.url_from_pattern('apply:submissions:list'))
Example #5
0
    def test_can_submit_batch_determination_more_info_comment(self):
        submissions = ApplicationSubmissionFactory.create_batch(4)

        url = self.url(None) + '?submissions=' + ','.join(
            [str(submission.id)
             for submission in submissions]) + '&action=more_info'
        data = {
            'submissions': [submission.id for submission in submissions],
            'data': 'some data',
            'outcome': NEEDS_MORE_INFO,
            'message': 'More Info',
            'author': self.user.id,
        }

        response = self.client.post(url, data, secure=True, follow=True)

        for submission in submissions:
            submission = self.refresh(submission)
            self.assertEqual(submission.status, 'more_info')
            self.assertEqual(submission.determinations.count(), 1)
            self.assertEqual(submission.activities.comments().count(), 1)

        self.assertRedirects(response,
                             self.url_from_pattern('apply:submissions:list'))
Example #6
0
 def setUpTestData(cls):
     super().setUpTestData()
     cls.submissions = ApplicationSubmissionFactory.create_batch(4)
     cls.staff = StaffFactory.create_batch(4)
     cls.reviewers = ReviewerFactory.create_batch(4)
     cls.roles = ReviewerRoleFactory.create_batch(2)