Tweak failing test

I've worked out this test is failing when FileDeleteView::post() calls
self.get_object() - that's when the 404 is being sent.  I can't work out
why though, because everything else looks fine.
This commit is contained in:
Anna Sidwell 2018-06-27 19:43:39 +01:00
parent a964ee03d2
commit a4072ba22a
2 changed files with 6 additions and 3 deletions

View File

@ -53,13 +53,15 @@ class FileTests(TestCase):
})
data = response.json()
self.assertIsInstance(data['id'], int)
self.assertEqual(data['is_valid'], True)
response = self.client.post(reverse('files:delete', kwargs={
'pk': data['id']
}))
self.assertEqual(response.status_code, 200)
data = response.json()
self.assertEqual(data['success'], True)

View File

@ -18,7 +18,8 @@ class FileUploadView(LoginRequiredMixin, FormView):
self.object.save()
return JsonResponse({
'is_valid': True, 'url': self.object.file.url,
'is_valid': True,
'url': self.object.file.url,
'name': self.object.file.name,
'id': self.object.pk
})