Ejemplo n.º 1
0
 def test_success_bad_data(self):
     """Test a post to the success view with missing data"""
     foia = FOIARequestFactory()
     request_factory = RequestFactory()
     request = request_factory.post(
         reverse("fine-uploader-success-request"), {"id": foia.pk})
     request.user = foia.user
     response = views.success_request(request)
     eq_(response.status_code, 400)
Ejemplo n.º 2
0
 def test_success_bad_comm(self):
     """Test a post to the success view with a non-existent foia"""
     request_factory = RequestFactory()
     request = request_factory.post(
         reverse("fine-uploader-success-request"), {
             "id": 1234,
             "key": "file_key"
         })
     request.user = UserFactory()
     response = views.success_request(request)
     eq_(response.status_code, 400)
Ejemplo n.º 3
0
 def test_success_bad_user(self):
     """Test a post to the success view with a bad user"""
     foia = FOIARequestFactory()
     request_factory = RequestFactory()
     request = request_factory.post(
         reverse("fine-uploader-success-request"), {
             "id": foia.pk,
             "key": "file_key"
         })
     request.user = UserFactory()
     response = views.success_request(request)
     eq_(response.status_code, 403)
Ejemplo n.º 4
0
 def test_success_success(self):
     """Test a successful post to the success view"""
     foia = FOIARequestFactory()
     request_factory = RequestFactory()
     request = request_factory.post(
         reverse("fine-uploader-success-request"), {
             "id": foia.pk,
             "key": "file_key"
         })
     request.user = foia.user
     response = views.success_request(request)
     eq_(response.status_code, 200)
     attachment = OutboundRequestAttachment.objects.get(foia=foia)
     eq_(attachment.ffile.name, "file_key")
     eq_(attachment.user, foia.user)
     assert_false(attachment.sent)