mirror of
https://github.com/haiwen/seahub.git
synced 2025-04-27 19:05:16 +00:00
Fix tests and replace mimetype with content_type
This commit is contained in:
parent
68efe49481
commit
887b6bbe03
@ -1,4 +1,4 @@
|
|||||||
[pytest]
|
[pytest]
|
||||||
python_files=test_*.py tests.py
|
python_files=test_*.py tests.py
|
||||||
addopts = -s -v
|
addopts = -s -v
|
||||||
DJANGO_SETTINGS_MODULE=seahub.settings
|
DJANGO_SETTINGS_MODULE=seahub.test_settings
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
python-dateutil
|
python-dateutil
|
||||||
|
python-memcached==1.57
|
||||||
chardet
|
chardet
|
||||||
six
|
six
|
||||||
Pillow>=2.6.1,<3.0.0
|
Pillow>=2.6.1,<3.0.0
|
||||||
Django==1.8.5
|
Django==1.8.5
|
||||||
Djblets==0.8.22
|
#Djblets==0.8.22
|
||||||
django-compressor==1.4
|
django-compressor==1.4
|
||||||
django-statici18n==1.1.2
|
django-statici18n==1.1.2
|
||||||
git+git://github.com/haiwen/django-constance.git@bde7f7cdfd0ed1631a6817fd4cd76f37bf54fe35#egg=django-constance[database]
|
git+git://github.com/haiwen/django-constance.git@bde7f7cdfd0ed1631a6817fd4cd76f37bf54fe35#egg=django-constance[database]
|
||||||
|
17
seahub/test_settings.py
Normal file
17
seahub/test_settings.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from .settings import *
|
||||||
|
|
||||||
|
# no cache for testing
|
||||||
|
CACHES = {
|
||||||
|
'default': {
|
||||||
|
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# enlarge api throttle
|
||||||
|
REST_FRAMEWORK = {
|
||||||
|
'DEFAULT_THROTTLE_RATES': {
|
||||||
|
'ping': '600/minute',
|
||||||
|
'anon': '5000/minute',
|
||||||
|
'user': '300/minute',
|
||||||
|
},
|
||||||
|
}
|
@ -111,7 +111,8 @@ def thumbnail_get(request, repo_id, size, path):
|
|||||||
try:
|
try:
|
||||||
with open(thumbnail_file, 'rb') as f:
|
with open(thumbnail_file, 'rb') as f:
|
||||||
thumbnail = f.read()
|
thumbnail = f.read()
|
||||||
return HttpResponse(content=thumbnail, mimetype='image/'+THUMBNAIL_EXTENSION)
|
return HttpResponse(content=thumbnail,
|
||||||
|
content_type='image/' + THUMBNAIL_EXTENSION)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
return HttpResponse()
|
return HttpResponse()
|
||||||
@ -234,7 +235,8 @@ def share_link_thumbnail_get(request, token, size, path):
|
|||||||
try:
|
try:
|
||||||
with open(thumbnail_file, 'rb') as f:
|
with open(thumbnail_file, 'rb') as f:
|
||||||
thumbnail = f.read()
|
thumbnail = f.read()
|
||||||
return HttpResponse(content=thumbnail, mimetype='image/'+THUMBNAIL_EXTENSION)
|
return HttpResponse(content=thumbnail,
|
||||||
|
content_type='image/' + THUMBNAIL_EXTENSION)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
return HttpResponse()
|
return HttpResponse()
|
||||||
|
@ -2025,7 +2025,7 @@ def image_view(request, filename):
|
|||||||
|
|
||||||
# Prepare response
|
# Prepare response
|
||||||
content_type, content_encoding = mimetypes.guess_type(filename)
|
content_type, content_encoding = mimetypes.guess_type(filename)
|
||||||
response = HttpResponse(content=file_content, mimetype=content_type)
|
response = HttpResponse(content=file_content, content_type=content_type)
|
||||||
response['Content-Disposition'] = 'inline; filename=%s' % filename
|
response['Content-Disposition'] = 'inline; filename=%s' % filename
|
||||||
if content_encoding:
|
if content_encoding:
|
||||||
response['Content-Encoding'] = content_encoding
|
response['Content-Encoding'] = content_encoding
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
mock==1.0.1
|
||||||
|
nose==1.3.7
|
||||||
exam==0.10.5
|
exam==0.10.5
|
||||||
splinter==0.7.2
|
splinter==0.7.2
|
||||||
requests==2.3.0
|
requests==2.3.0
|
||||||
|
Loading…
Reference in New Issue
Block a user