This repository has been archived by the owner on Feb 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 498
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow for caps in file name suffixes #206
@schinkelg ran aground of this one and I took the opportunity to add a test to catch this sort of thing for next time.
- Loading branch information
1 parent
5b88ebf
commit fa4924d
Showing
5 changed files
with
102 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from django.test import TestCase | ||
|
||
from ..signals import ConsumerDeclaration | ||
|
||
|
||
class SignalsTestCase(TestCase): | ||
|
||
def test_test_handles_various_file_names_true(self): | ||
|
||
prefixes = ( | ||
"doc", "My Document", "Μυ Γρεεκ Δοψθμεντ", "Doc -with - tags", | ||
"A document with a . in it", "Doc with -- in it" | ||
) | ||
suffixes = ( | ||
"pdf", "jpg", "gif", "png", "tiff", "tif", "pnm", "bmp", | ||
"PDF", "JPG", "GIF", "PNG", "TIFF", "TIF", "PNM", "BMP", | ||
"pDf", "jPg", "gIf", "pNg", "tIff", "tIf", "pNm", "bMp", | ||
) | ||
|
||
for prefix in prefixes: | ||
for suffix in suffixes: | ||
name = "{}.{}".format(prefix, suffix) | ||
self.assertTrue(ConsumerDeclaration.test(name)) | ||
|
||
def test_test_handles_various_file_names_false(self): | ||
|
||
prefixes = ("doc",) | ||
suffixes = ("txt", "markdown", "",) | ||
|
||
for prefix in prefixes: | ||
for suffix in suffixes: | ||
name = "{}.{}".format(prefix, suffix) | ||
self.assertFalse(ConsumerDeclaration.test(name)) | ||
|
||
self.assertFalse(ConsumerDeclaration.test("")) | ||
self.assertFalse(ConsumerDeclaration.test("doc")) |