示例#1
0
    def test_not_asked_again(self):
        submission = SealedSubmissionFactory()

        self.post_page(submission, {}, 'sealed')

        # Now request the page again
        response = self.get_page(submission)
        self.assertEqual(response.status_code, 200)
示例#2
0
    def test_peeking_is_logged(self):
        submission = SealedSubmissionFactory()
        self.post_page(submission, {}, 'sealed')

        self.assertTrue('peeked' in self.client.session)
        self.assertTrue(str(submission.id) in self.client.session['peeked'])
        self.assertEqual(Activity.objects.count(), 1)
        self.assertTrue('sealed' in Activity.objects.first().message)
示例#3
0
 def test_cant_post_to_sealed(self):
     submission = SealedSubmissionFactory()
     response = self.post_page(submission, {'some': 'data'}, 'sealed')
     # Because of the redirect chain the url returned is not absolute
     url = self.url_from_pattern('funds:submissions:sealed',
                                 kwargs={'pk': submission.id},
                                 absolute=False)
     self.assertRedirects(response, url)
示例#4
0
    def test_can_view_multiple_sealed(self):
        sealed_round = SealedRoundFactory()
        first, second = SealedSubmissionFactory.create_batch(2, round=sealed_round)

        self.post_page(first, {}, 'sealed')
        self.post_page(second, {}, 'sealed')

        self.assertTrue('peeked' in self.client.session)
        self.assertTrue(str(first.id) in self.client.session['peeked'])
        self.assertTrue(str(second.id) in self.client.session['peeked'])
示例#5
0
 def test_can_post_to_sealed(self):
     submission = SealedSubmissionFactory()
     response = self.post_page(submission, {}, 'sealed')
     url = self.url_from_pattern('funds:submissions:detail', kwargs={'pk': submission.id})
     self.assertRedirects(response, url)
示例#6
0
 def test_redirected_to_sealed(self):
     submission = SealedSubmissionFactory()
     response = self.get_page(submission)
     url = self.url_from_pattern('funds:submissions:sealed', kwargs={'pk': submission.id})
     self.assertRedirects(response, url)