Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2018-09-23 02:25:55 +00:00
commit 7d2e9a27af
4 changed files with 11 additions and 5 deletions

View File

@ -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']
})) }))

View File

@ -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'),
] ]

View File

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

View File

@ -96,7 +96,7 @@ class CaseStudyTests(TestCase):
def test_get_renewable_generation_detail_with_wind(self): def test_get_renewable_generation_detail_with_wind(self):
"""get_renewable_generation_detail() should return the description prefixed with 'wind power'""" """get_renewable_generation_detail() should return the description prefixed with 'wind power'"""
case_study = CaseStudy(generation_technology='SSWE') case_study = CaseStudy(generation_technology='SSWE')
self.assertEqual(case_study.get_renewable_generation_detail(), "Wind energy Small-scale (less than 500kW)") self.assertEqual(case_study.get_renewable_generation_detail(), "Wind energy Small-scale (less than 500 kW)")
def test_get_renewable_generation_detail_with_other(self): def test_get_renewable_generation_detail_with_other(self):
"""get_renewable_generation_detail() should return the detail provided in .generation_technology_other""" """get_renewable_generation_detail() should return the detail provided in .generation_technology_other"""