Fix crashing test
This commit is contained in:
parent
7df7d7df5b
commit
b648c28d70
@ -48,7 +48,7 @@ class FileTests(TestCase):
|
|||||||
login = self.login()
|
login = self.login()
|
||||||
|
|
||||||
with open('apps/map/static/map/ojuso-logo-white.png', 'rb') as fp:
|
with open('apps/map/static/map/ojuso-logo-white.png', 'rb') as fp:
|
||||||
response = self.client.post(reverse('files:upload'), {
|
response = self.client.post(reverse('files:upload_image'), {
|
||||||
'file': fp
|
'file': fp
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ class FileTests(TestCase):
|
|||||||
self.assertIsInstance(data['id'], int)
|
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_image', kwargs={
|
||||||
'pk': data['id']
|
'pk': data['id']
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
|
|
||||||
from .views import FileUploadView, FileDeleteView, ImageFileUploadView
|
from .views import (FileUploadView, FileDeleteView, ImageFileUploadView,
|
||||||
|
ImageFileDeleteView)
|
||||||
|
|
||||||
app_name = 'files'
|
app_name = 'files'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^upload/$', FileUploadView.as_view(), name='upload'),
|
url(r'^upload/$', FileUploadView.as_view(), name='upload'),
|
||||||
url(r'^upload/image/$', ImageFileUploadView.as_view(), name='upload'),
|
url(r'^upload/image/$', ImageFileUploadView.as_view(), name='upload_image'),
|
||||||
url(r'^delete/(?P<pk>\d+)/$', FileDeleteView.as_view(), name='delete'),
|
url(r'^delete/(?P<pk>\d+)/$', FileDeleteView.as_view(), name='delete'),
|
||||||
|
url(r'^delete/image/(?P<pk>\d+)/$', ImageFileDeleteView.as_view(), name='delete_image'),
|
||||||
]
|
]
|
||||||
|
@ -50,3 +50,7 @@ class FileDeleteView(LoginRequiredMixin, DetailView):
|
|||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
'success': True
|
'success': True
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
class ImageFileDeleteView(FileDeleteView):
|
||||||
|
model = ImageFile
|
||||||
|
Loading…
Reference in New Issue
Block a user