Added FileExtensionValidator tests for uppercase and missing file extensions.
This commit is contained in:
parent
c01409c789
commit
b137add6cf
|
@ -248,13 +248,19 @@ TEST_DATA = [
|
|||
(RegexValidator('a', flags=re.IGNORECASE), 'A', None),
|
||||
|
||||
(FileExtensionValidator(['txt']), ContentFile('contents', name='fileWithUnsupportedExt.jpg'), ValidationError),
|
||||
(FileExtensionValidator(['txt']), ContentFile('contents', name='fileWithNoExtenstion'), ValidationError),
|
||||
(FileExtensionValidator(['txt']), ContentFile('contents', name='fileWithUnsupportedExt.JPG'), ValidationError),
|
||||
(FileExtensionValidator(['txt']), ContentFile('contents', name='fileWithNoExtension'), ValidationError),
|
||||
(FileExtensionValidator(['']), ContentFile('contents', name='fileWithAnExtension.txt'), ValidationError),
|
||||
(FileExtensionValidator([]), ContentFile('contents', name='file.txt'), ValidationError),
|
||||
|
||||
(FileExtensionValidator(['']), ContentFile('contents', name='fileWithNoExtension'), None),
|
||||
(FileExtensionValidator(['txt']), ContentFile('contents', name='file.txt'), None),
|
||||
(FileExtensionValidator(['txt']), ContentFile('contents', name='file.TXT'), None),
|
||||
(FileExtensionValidator(), ContentFile('contents', name='file.jpg'), None),
|
||||
|
||||
(validate_image_file_extension, ContentFile('contents', name='file.jpg'), None),
|
||||
(validate_image_file_extension, ContentFile('contents', name='file.png'), None),
|
||||
(validate_image_file_extension, ContentFile('contents', name='file.PNG'), None),
|
||||
(validate_image_file_extension, ContentFile('contents', name='file.txt'), ValidationError),
|
||||
(validate_image_file_extension, ContentFile('contents', name='file'), ValidationError),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue