Fixing some unit tests

This commit is contained in:
Garret Wassermann
2022-04-22 14:52:51 -04:00
parent 449e3f9214
commit 5e8f5fed62
5 changed files with 20 additions and 11 deletions

View File

@ -19,7 +19,9 @@ def validate_file_extension(value):
if hasattr(settings, 'VALID_EXTENSIONS'):
valid_extensions = settings.VALID_EXTENSIONS
else:
valid_extensions = ['.txt', '.pdf', '.doc', '.docx', '.odt', '.jpg', '.png', '.eml']
valid_extensions = ['.txt', '.asc', '.htm', '.html', '.pdf', '.doc', '.docx', '.odt', '.jpg', '.png', '.eml']
if not ext.lower() in valid_extensions:
raise ValidationError('Unsupported file extension.')
# TODO: one more check in case it is a file with no extension; we should always allow that?
if not (ext.lower() == '' or ext.lower() == '.'):
raise ValidationError('Unsupported file extension: %s.' % ext.lower())