Fix testing example. Closes #3346

This commit is contained in:
Tom Christie 2015-08-28 13:52:18 +01:00
parent 8264222497
commit 3a0d54c7fb

View File

@ -200,6 +200,7 @@ You can use any of REST framework's test case classes as you would for the regul
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from rest_framework import status from rest_framework import status
from rest_framework.test import APITestCase from rest_framework.test import APITestCase
from myproject.apps.core.models import Account
class AccountTests(APITestCase): class AccountTests(APITestCase):
def test_create_account(self): def test_create_account(self):
@ -210,7 +211,8 @@ You can use any of REST framework's test case classes as you would for the regul
data = {'name': 'DabApps'} data = {'name': 'DabApps'}
response = self.client.post(url, data, format='json') response = self.client.post(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(response.data, data) self.assertEqual(Account.objects.count(), 1)
self.assertEqual(Account.objects.get().name, 'DabApps')
--- ---