[PATCH 16/25] tests: Rename 'test_person'
Stephen Finucane
stephen.finucane at intel.com
Fri Jun 24 07:53:37 AEST 2016
Reflect the purpose of these tests - validation of the autocomplete
feature - in the filename.
Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
patchwork/tests/test_completion.py | 59 ++++++++++++++++++++++++++++++++++++
patchwork/tests/test_person.py | 59 ------------------------------------
2 files changed, 59 insertions(+), 59 deletions(-)
create mode 100644 patchwork/tests/test_completion.py
delete mode 100644 patchwork/tests/test_person.py
diff --git a/patchwork/tests/test_completion.py b/patchwork/tests/test_completion.py
new file mode 100644
index 0000000..a07999a
--- /dev/null
+++ b/patchwork/tests/test_completion.py
@@ -0,0 +1,59 @@
+# Patchwork - automated patch tracking system
+# Copyright (C) 2013 Jeremy Kerr <jk at ozlabs.org>
+#
+# This file is part of the Patchwork package.
+#
+# Patchwork is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Patchwork is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Patchwork; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from __future__ import absolute_import
+
+import json
+
+from django.core.urlresolvers import reverse
+from django.test import TestCase
+from django.utils.six.moves import range
+
+from patchwork.tests.utils import create_person
+
+
+class SubmitterCompletionTest(TestCase):
+
+ """Validate the 'submitter' autocomplete endpoint."""
+
+ def test_name_complete(self):
+ people = [create_person(name='Test name'), create_person(name=None)]
+ response = self.client.get(reverse('api-submitters'), {'q': 'name'})
+ self.assertEqual(response.status_code, 200)
+ data = json.loads(response.content.decode())
+ self.assertEqual(len(data), 1)
+ self.assertEqual(data[0]['name'], people[0].name)
+
+ def test_email_complete(self):
+ people = [create_person(email='test1 at example.com'),
+ create_person(email='test2 at example.com')]
+ response = self.client.get(reverse('api-submitters'), {'q': 'test2'})
+ self.assertEqual(response.status_code, 200)
+ data = json.loads(response.content.decode())
+ self.assertEqual(len(data), 1)
+ self.assertEqual(data[0]['email'], people[1].email)
+
+ def test_param_limit(self):
+ for i in range(10):
+ create_person()
+ response = self.client.get(reverse('api-submitters'),
+ {'q': 'test', 'l': 5})
+ self.assertEqual(response.status_code, 200)
+ data = json.loads(response.content.decode())
+ self.assertEqual(len(data), 5)
diff --git a/patchwork/tests/test_person.py b/patchwork/tests/test_person.py
deleted file mode 100644
index a07999a..0000000
--- a/patchwork/tests/test_person.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2013 Jeremy Kerr <jk at ozlabs.org>
-#
-# This file is part of the Patchwork package.
-#
-# Patchwork is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# Patchwork is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Patchwork; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-from __future__ import absolute_import
-
-import json
-
-from django.core.urlresolvers import reverse
-from django.test import TestCase
-from django.utils.six.moves import range
-
-from patchwork.tests.utils import create_person
-
-
-class SubmitterCompletionTest(TestCase):
-
- """Validate the 'submitter' autocomplete endpoint."""
-
- def test_name_complete(self):
- people = [create_person(name='Test name'), create_person(name=None)]
- response = self.client.get(reverse('api-submitters'), {'q': 'name'})
- self.assertEqual(response.status_code, 200)
- data = json.loads(response.content.decode())
- self.assertEqual(len(data), 1)
- self.assertEqual(data[0]['name'], people[0].name)
-
- def test_email_complete(self):
- people = [create_person(email='test1 at example.com'),
- create_person(email='test2 at example.com')]
- response = self.client.get(reverse('api-submitters'), {'q': 'test2'})
- self.assertEqual(response.status_code, 200)
- data = json.loads(response.content.decode())
- self.assertEqual(len(data), 1)
- self.assertEqual(data[0]['email'], people[1].email)
-
- def test_param_limit(self):
- for i in range(10):
- create_person()
- response = self.client.get(reverse('api-submitters'),
- {'q': 'test', 'l': 5})
- self.assertEqual(response.status_code, 200)
- data = json.loads(response.content.decode())
- self.assertEqual(len(data), 5)
--
1.7.4.1
More information about the Patchwork
mailing list