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:
parent
a964ee03d2
commit
a4072ba22a
@ -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)
|
||||
|
@ -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
|
||||
})
|
||||
@ -45,7 +46,7 @@ class FileDeleteView(LoginRequiredMixin, DetailView):
|
||||
raise PermissionDenied
|
||||
|
||||
self.object.delete()
|
||||
|
||||
|
||||
return JsonResponse({
|
||||
'success': True
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user