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
4ddc6aeacf
commit
a900a146e2
@ -53,13 +53,15 @@ class FileTests(TestCase):
|
|||||||
})
|
})
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
self.assertIsInstance(data['id'], int)
|
||||||
self.assertEqual(data['is_valid'], True)
|
self.assertEqual(data['is_valid'], True)
|
||||||
|
|
||||||
response = self.client.post(reverse('files:delete', kwargs={
|
response = self.client.post(reverse('files:delete', kwargs={
|
||||||
'pk': data['id']
|
'pk': data['id']
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
|
||||||
self.assertEqual(data['success'], True)
|
self.assertEqual(data['success'], True)
|
||||||
|
@ -18,7 +18,8 @@ class FileUploadView(LoginRequiredMixin, FormView):
|
|||||||
self.object.save()
|
self.object.save()
|
||||||
|
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
'is_valid': True, 'url': self.object.file.url,
|
'is_valid': True,
|
||||||
|
'url': self.object.file.url,
|
||||||
'name': self.object.file.name,
|
'name': self.object.file.name,
|
||||||
'id': self.object.pk
|
'id': self.object.pk
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user