Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #6817] Displaying document 'image/tiff' is broken because bro… #6818

Merged
merged 1 commit into from
Jan 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions geonode/documents/enumerations.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@

'bm': 'image',
'bmp': 'image',
'dwg': 'image',
'dxf': 'image',
'dwg': 'archive',
'dxf': 'archive',
'fif': 'image',
'gif': 'image',
'jpg': 'image',
'jpe': 'image',
'jpeg': 'image',
'png': 'image',
'tif': 'image',
'tiff': 'image',
'pbm': 'image',
'tif': 'archive',
'tiff': 'archive',
'pbm': 'archive',

'odp': 'presentation',
'ppt': 'presentation',
Expand Down
18 changes: 18 additions & 0 deletions geonode/documents/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
from geonode.documents.forms import DocumentFormMixin
from geonode.tests.utils import NotificationsTestsHelper
from geonode.base.populate_test_data import create_models
from geonode.documents.enumerations import DOCUMENT_TYPE_MAP
from geonode.documents.models import Document, DocumentResourceLink


Expand All @@ -76,6 +77,23 @@ def setUp(self):
b'\x00\x00\x00\x01\x00\x01\x00\x00\x02\x02D\x01\x00;')
self.anonymous_user = get_anonymous_user()

def test_document_mimetypes_rendering(self):
ARCHIVETYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'archive']
AUDIOTYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'audio']
IMGTYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'image']
VIDEOTYPES = [_e for _e, _t in DOCUMENT_TYPE_MAP.items() if _t == 'video']
self.assertIsNotNone(ARCHIVETYPES)
self.assertIsNotNone(AUDIOTYPES)
self.assertIsNotNone(IMGTYPES)
self.assertIsNotNone(VIDEOTYPES)

# Make sure we won't have template rendering issues
self.assertTrue('dwg' in ARCHIVETYPES)
self.assertTrue('dxf' in ARCHIVETYPES)
self.assertTrue('tif' in ARCHIVETYPES)
self.assertTrue('tiff' in ARCHIVETYPES)
self.assertTrue('pbm' in ARCHIVETYPES)

def test_create_document_with_no_rel(self):
"""Tests the creation of a document with no relations"""

Expand Down