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
=== modified file 'ticket_system/people/tests.py'
--- ticket_system/people/tests.py 2013-12-09 17:43:12 +0000
+++ ticket_system/people/tests.py 2013-12-10 18:41:22 +0000
@@ -15,7 +15,7 @@
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17from django.test import TestCase17from django.test import TestCase
18from tastypie.test import ResourceTestCase18from ci_utils.tastypie.test import TastypieTestCase
19from people.models import Person19from people.models import Person
2020
2121
@@ -43,19 +43,17 @@
43 "chris.johnston@canonical.com")43 "chris.johnston@canonical.com")
4444
4545
46class PersonResourceTest(ResourceTestCase):46class PersonResourceTest(TastypieTestCase):
4747
48 def setUp(self):48 def setUp(self):
49 super(PersonResourceTest, self).setUp()49 super(PersonResourceTest, self).setUp('/api/v1')
50 create_person()50 create_person()
51 self.person_1 = Person.objects.get(name='Chris Johnston')51 self.person_1 = Person.objects.get(name='Chris Johnston')
52 self.detail_url = '/api/v1/person/{0}/'.format(self.person_1.pk)52 self.detail_url = 'person/{0}/'.format(self.person_1.pk)
5353
54 def test_get_person_list_json(self):54 def test_get_person_list_json(self):
55 resp = self.api_client.get('/api/v1/person/', format='json')55 obj = self.getResource('person/')
56 self.assertValidJSONResponse(resp)56 self.assertEqual(obj['objects'][0], {
57 self.assertEqual(len(self.deserialize(resp)['objects']), 1)
58 self.assertEqual(self.deserialize(resp)['objects'][0], {
59 u'email': u'chris.johnston@canonical.com',57 u'email': u'chris.johnston@canonical.com',
60 u'id': self.person_1.pk,58 u'id': self.person_1.pk,
61 u'is_team': False,59 u'is_team': False,
@@ -64,9 +62,8 @@
64 })62 })
6563
66 def test_get_person_detail_json(self):64 def test_get_person_detail_json(self):
67 resp = self.api_client.get(self.detail_url)65 obj = self.getResource(self.detail_url)
68 self.assertValidJSONResponse(resp)
6966
70 self.assertKeys(self.deserialize(resp),67 self.assertKeys(obj,
71 ['email', 'id', 'is_team', 'name', 'resource_uri'])68 ['email', 'id', 'is_team', 'name', 'resource_uri'])
72 self.assertEqual(self.deserialize(resp)['name'], 'Chris Johnston')69 self.assertEqual(obj['name'], 'Chris Johnston')

Subscribers

People subscribed via source and target branches