Fix crashing test

This commit is contained in:
Carl van Tonder 2018-09-22 22:25:04 -04:00 committed by Naomi
parent 7df7d7df5b
commit b648c28d70
3 changed files with 10 additions and 4 deletions

View File

@ -48,7 +48,7 @@ class FileTests(TestCase):
login = self.login()
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
})
@ -56,7 +56,7 @@ class FileTests(TestCase):
self.assertIsInstance(data['id'], int)
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']
}))

View File

@ -1,11 +1,13 @@
from django.conf.urls import url
from .views import FileUploadView, FileDeleteView, ImageFileUploadView
from .views import (FileUploadView, FileDeleteView, ImageFileUploadView,
ImageFileDeleteView)
app_name = 'files'
urlpatterns = [
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/image/(?P<pk>\d+)/$', ImageFileDeleteView.as_view(), name='delete_image'),
]

View File

@ -50,3 +50,7 @@ class FileDeleteView(LoginRequiredMixin, DetailView):
return JsonResponse({
'success': True
})
class ImageFileDeleteView(FileDeleteView):
model = ImageFile