-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
26 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -887,6 +887,29 @@ class DontSearchOwnerEmailFolderAdmin(FolderAdmin): | |
folder_qs = folderadmin.filter_folder(Folder.objects.all(), ['[email protected]']) | ||
self.assertEqual(len(folder_qs), 0) | ||
|
||
def test_search_special_characters(self): | ||
""" | ||
Regression test for https://github.com/divio/django-filer/pull/945. | ||
Because of a wrong unquoting function being used, searches with | ||
some "_XX" sequences got unquoted as unicode characters. | ||
For example, "_ec" gets unquoted as u'ì'. | ||
""" | ||
url = reverse('admin:filer-directory_listing', | ||
kwargs={'folder_id': self.parent.id}) | ||
|
||
# Create a file with a problematic filename | ||
problematic_file = django.core.files.base.ContentFile('some data') | ||
filename = u'christopher_eccleston' | ||
problematic_file.name = filename | ||
self.spam_file = File.objects.create( | ||
owner=self.staff_user, original_filename=filename, | ||
file=problematic_file, folder=self.parent) | ||
|
||
# Valid search for the filename, should have one result | ||
response = self.client.get(url, {'q': filename}) | ||
item_list = response.context['paginated_items'].object_list | ||
self.assertEqual(len(item_list), 1) | ||
|
||
|
||
class FilerAdminContextTests(TestCase, BulkOperationsMixin): | ||
def setUp(self): | ||
|
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