Commit 54d968c9 authored by Orestis Ioannou's avatar Orestis Ioannou Committed by Raphaël Hertzog

core: make package search case insensitive

According to the policy, package names are always lower case so
transforming the search query into lower case enables case
insensitive package search.

[hertzog@debian.org:
- Add author to COPYRIGHT]

Closes: #788251
Signed-off-by: Raphaël Hertzog's avatarRaphaël Hertzog <hertzog@debian.org>
parent a6336f42
......@@ -17,6 +17,7 @@ By alphabetic order:
© 2014-2015 Christophe Siraut <chris@debian.org>
© 2015 Didier Raboud <odyx@debian.org>
© 2014 Dimitri John Ledkov <dimitri.ledkov@canonical.com>
© 2015 Orestis Ioannou <orestis@oioannou.com>
© 2014-2015 James McCoy <jamessan@debian.org>
© 2014 Joseph Herlant <herlantj@gmail.com>
© 2014 Martin Zobel-Helas <zobel@debian.org>
......
......@@ -264,6 +264,15 @@ class PackageSearchViewTest(TestCase):
self.assertIn('package_name', response.context)
self.assertEqual(response.context['package_name'], 'no-exist')
def test_case_insensitive_package_search(self):
"""
Tests that package search is case insensitive
"""
response = self.client.get(reverse('dtracker-package-search'), {
'package_name': 'DuMmy-PACKAGE'
})
self.assertRedirects(response, self.source_package.get_absolute_url())
class OpenSearchDescriptionTest(TestCase):
"""
......
......@@ -94,7 +94,7 @@ class PackageSearchView(View):
def get(self, request):
if 'package_name' not in self.request.GET:
raise Http404
package_name = self.request.GET.get('package_name')
package_name = self.request.GET.get('package_name').lower()
package = get_web_package(package_name)
if package is not None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment