Last active
September 19, 2018 13:04
-
-
Save YAHYA-H/68fa4241d2077d92f8a765007d8204e0 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.test import import TestCase | |
from rest_framework import status | |
from rest_framework import APIClient | |
class SignupTestCase(TestCase): | |
def setup(): | |
self.client = APIClient | |
self.user = { | |
"username":"username001", | |
"email":"[email protected]", | |
"password":"password001" | |
} | |
def test_signup_new_user(self): | |
"""Test user registration""" | |
response = self.client.post( | |
'/api/signup', | |
data=json.dumps(self.user), | |
content_type="application/json") | |
result = json.loads(response.data) | |
self.assertEqual(self.response.status_code, status.HTTP_201_CREATED) |
I foresee a syntax error on the second function. Good job though!
make sure your doc strings are consistent.......you have not documented you, class.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The tests are well written.
You may need to consider the indentation level for the second function.