Skip to content

Instantly share code, notes, and snippets.

@YAHYA-H
Last active September 19, 2018 13:04
Show Gist options
  • Save YAHYA-H/68fa4241d2077d92f8a765007d8204e0 to your computer and use it in GitHub Desktop.
Save YAHYA-H/68fa4241d2077d92f8a765007d8204e0 to your computer and use it in GitHub Desktop.
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":"username001@example.com",
"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)
@gitaumoses4
Copy link

The tests are well written.
You may need to consider the indentation level for the second function.

@bevkololi
Copy link

I foresee a syntax error on the second function. Good job though!

@charisschomba
Copy link

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