Exemplo n.º 1
0
 def test_autosave_bad(self):
     """Test a failed autosave"""
     composer = FOIAComposerFactory(status='started')
     request = self.request_factory.post(
         reverse('foia-autosave', kwargs={'idx': composer.pk}),
         {
             'agencies': 'foobar',
             'requested_docs': 'ABC',
         },
     )
     request.user = composer.user
     request = mock_middleware(request)
     response = autosave(request, idx=composer.pk)
     eq_(response.status_code, 400)
Exemplo n.º 2
0
 def test_autosave_bad(self):
     """Test a failed autosave"""
     composer = FOIAComposerFactory(status="started")
     request = self.request_factory.post(
         reverse("foia-autosave", kwargs={"idx": composer.pk}),
         {
             "agencies": "foobar",
             "requested_docs": "ABC"
         },
     )
     request.user = composer.user
     request = mock_middleware(request)
     response = autosave(request, idx=composer.pk)
     eq_(response.status_code, 400)
Exemplo n.º 3
0
 def test_autosave_good(self):
     """Test a succesful autosave"""
     composer = FOIAComposerFactory(status='started')
     request = self.request_factory.post(
         reverse('foia-autosave', kwargs={'idx': composer.pk}),
         {
             'title': 'New Title',
             'requested_docs': 'ABC',
         },
     )
     request.user = composer.user
     request = mock_middleware(request)
     response = autosave(request, idx=composer.pk)
     eq_(response.status_code, 200)
     composer.refresh_from_db()
     eq_(composer.title, 'New Title')
     eq_(composer.requested_docs, 'ABC')
Exemplo n.º 4
0
 def test_autosave_good(self):
     """Test a succesful autosave"""
     composer = FOIAComposerFactory(status="started")
     request = self.request_factory.post(
         reverse("foia-autosave", kwargs={"idx": composer.pk}),
         {
             "title": "New Title",
             "requested_docs": "ABC"
         },
     )
     request.user = composer.user
     request = mock_middleware(request)
     response = autosave(request, idx=composer.pk)
     eq_(response.status_code, 200)
     composer.refresh_from_db()
     eq_(composer.title, "New Title")
     eq_(composer.requested_docs, "ABC")