From b137add6cf0cd0e7e7d7d2dff2902dd54e92453e Mon Sep 17 00:00:00 2001 From: Arne de Laat Date: Tue, 6 Jun 2017 10:51:08 +0200 Subject: [PATCH] Added FileExtensionValidator tests for uppercase and missing file extensions. --- tests/validators/tests.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/validators/tests.py b/tests/validators/tests.py index ba7038094c..d7888ef9a7 100644 --- a/tests/validators/tests.py +++ b/tests/validators/tests.py @@ -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), ]