Created
April 21, 2016 22:04
-
-
Save darthwade/10851aaa20b6603d5c1d6028e0ebbed7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.urlresolvers import reverse | |
from rest_framework import status | |
from rest_framework.test import APITestCase | |
from foodster.apps.core.models import Account | |
class AccountTests(APITestCase): | |
def test_create_account(self): | |
""" | |
Ensure we can create a new account object. | |
""" | |
url = reverse('account-list') | |
data = {'first_name': 'Vadym', 'last_name': 'Petrychenko', 'email': '[email protected]'} | |
response = self.client.post(url, data, format='json') | |
self.assertEqual(response.status_code, status.HTTP_201_CREATED) | |
account = Account.objects.get(email=data['email']) | |
self.assertEqual(Account.objects.count(), 1) | |
self.assertEqual(account.first_name, data['first_name']) | |
self.assertEqual(account.last_name, data['last_name']) | |
self.assertEqual(account.email, data['email']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment