Skip to content

Commit

Permalink
Added tests for SubjectResource
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiDuma committed Mar 17, 2013
1 parent 72f6469 commit aa44a43
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions vmc_backend/api/tests/subject_resource_test.py
@@ -0,0 +1,22 @@
from tastypie.test import ResourceTestCase
from vmc_backend.api.resources import SubjectResource
from vmc_backend.factories import SubjectFactory

class SubjectResourceTest(ResourceTestCase):
def setUp(self):
super(SubjectResourceTest, self).setUp()

self.subject_1 = SubjectFactory()
self.subject_2 = SubjectFactory()

self.detail_url = '/api/v1/subject/{0}/'.format(self.subject_1.pk)

def test_get_detail_json(self):
resp = self.api_client.get(self.detail_url, format='json')
self.assertValidJSONResponse(resp)

def test_get_list_json(self):
resp = self.api_client.get('/api/v1/entries/', format='json')

This comment has been minimized.

Copy link
@bogdanciobanu

bogdanciobanu Mar 18, 2013

Collaborator

It is /api/v1/subject, not /entries.

self.assertValidJSONResponse(resp)

self.assertEqual(len(self.deserialize(resp)['objects']), 2)

0 comments on commit aa44a43

Please sign in to comment.