Merge lp:~cjohnston/ubuntu-ci-services-itself/ts-people-ci-utils into lp:ubuntu-ci-services-itself

Proposed by Chris Johnston
Status: Merged
Approved by: Chris Johnston
Approved revision: 24
Merged at revision: 24
Proposed branch: lp:~cjohnston/ubuntu-ci-services-itself/ts-people-ci-utils
Merge into: lp:ubuntu-ci-services-itself
Prerequisite: lp:~cjohnston/ubuntu-ci-services-itself/ts-project-tests
Diff against target: 50 lines (+9/-12)
1 file modified
ticket_system/people/tests.py (+9/-12)
To merge this branch: bzr merge lp:~cjohnston/ubuntu-ci-services-itself/ts-people-ci-utils
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Review via email: mp+198448@code.launchpad.net

Commit message

Switch ts people app to use ci-utils

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ticket_system/people/tests.py'
2--- ticket_system/people/tests.py 2013-12-09 17:43:12 +0000
3+++ ticket_system/people/tests.py 2013-12-10 18:41:22 +0000
4@@ -15,7 +15,7 @@
5 # along with this program. If not, see <http://www.gnu.org/licenses/>.
6
7 from django.test import TestCase
8-from tastypie.test import ResourceTestCase
9+from ci_utils.tastypie.test import TastypieTestCase
10 from people.models import Person
11
12
13@@ -43,19 +43,17 @@
14 "chris.johnston@canonical.com")
15
16
17-class PersonResourceTest(ResourceTestCase):
18+class PersonResourceTest(TastypieTestCase):
19
20 def setUp(self):
21- super(PersonResourceTest, self).setUp()
22+ super(PersonResourceTest, self).setUp('/api/v1')
23 create_person()
24 self.person_1 = Person.objects.get(name='Chris Johnston')
25- self.detail_url = '/api/v1/person/{0}/'.format(self.person_1.pk)
26+ self.detail_url = 'person/{0}/'.format(self.person_1.pk)
27
28 def test_get_person_list_json(self):
29- resp = self.api_client.get('/api/v1/person/', format='json')
30- self.assertValidJSONResponse(resp)
31- self.assertEqual(len(self.deserialize(resp)['objects']), 1)
32- self.assertEqual(self.deserialize(resp)['objects'][0], {
33+ obj = self.getResource('person/')
34+ self.assertEqual(obj['objects'][0], {
35 u'email': u'chris.johnston@canonical.com',
36 u'id': self.person_1.pk,
37 u'is_team': False,
38@@ -64,9 +62,8 @@
39 })
40
41 def test_get_person_detail_json(self):
42- resp = self.api_client.get(self.detail_url)
43- self.assertValidJSONResponse(resp)
44+ obj = self.getResource(self.detail_url)
45
46- self.assertKeys(self.deserialize(resp),
47+ self.assertKeys(obj,
48 ['email', 'id', 'is_team', 'name', 'resource_uri'])
49- self.assertEqual(self.deserialize(resp)['name'], 'Chris Johnston')
50+ self.assertEqual(obj['name'], 'Chris Johnston')

Subscribers

People subscribed via source and target branches