1 # Patchwork - automated patch tracking system
2 # Copyright (C) 2011 Jeremy Kerr <jk@ozlabs.org>
4 # This file is part of the Patchwork package.
6 # Patchwork is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # Patchwork is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with Patchwork; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 from django.test import TestCase
22 from django.test.client import Client
23 from patchwork.tests.utils import defaults, create_user, find_in_context
25 class FilterQueryStringTest(TestCase):
26 def testFilterQSEscaping(self):
27 """test that filter fragments in a query string are properly escaped,
28 and stray ampersands don't get reflected back in the filter
30 project = defaults.project
31 defaults.project.save()
32 url = '/project/%s/list/?submitter=a%%26b=c' % project.linkname
33 response = self.client.get(url)
34 self.failUnlessEqual(response.status_code, 200)
35 self.failIf('submitter=a&b=c' in response.content)
36 self.failIf('submitter=a&b=c' in response.content)
38 def testUTF8QSHandling(self):
39 """test that non-ascii characters can be handled by the filter
41 project = defaults.project
42 defaults.project.save()
43 url = '/project/%s/list/?submitter=%%E2%%98%%83' % project.linkname
44 response = self.client.get(url)
45 self.failUnlessEqual(response.status_code, 200)