summaryrefslogtreecommitdiffstats
path: root/apps/patchwork/tests
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-10-13 13:04:31 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-10-13 13:04:31 +0800
commit9d22330effa8d433ec39edc37ca4e3a1e3206b85 (patch)
tree3a9017cb0b48ecb5bbc7212f8c88cf6053fbaa0f /apps/patchwork/tests
parentdf1abefaaa678cedc4ce0293fd84bb4164c9852d (diff)
downloadpatchwork-9d22330effa8d433ec39edc37ca4e3a1e3206b85.tar.bz2
patchwork-9d22330effa8d433ec39edc37ca4e3a1e3206b85.tar.xz
views/base: Implement limit for submitter autocompletion
Add a limit parameter to the completion view, and pass a limit of 20 results in the javascript. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps/patchwork/tests')
-rw-r--r--apps/patchwork/tests/person.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/patchwork/tests/person.py b/apps/patchwork/tests/person.py
index 63bbadb..d948096 100644
--- a/apps/patchwork/tests/person.py
+++ b/apps/patchwork/tests/person.py
@@ -44,3 +44,12 @@ class SubmitterCompletionTest(TestCase):
data = json.loads(response.content)
self.assertEquals(len(data), 1)
self.assertEquals(data[0]['fields']['email'], 'test2@example.com')
+
+ def testCompleteLimit(self):
+ for i in range(3,10):
+ person = Person(email = 'test%d@example.com' % i)
+ person.save()
+ response = self.client.get('/submitter/', {'q': 'test', 'l': 5})
+ self.assertEquals(response.status_code, 200)
+ data = json.loads(response.content)
+ self.assertEquals(len(data), 5)