Skip to content
Snippets Groups Projects
Commit 1e96df7c authored by Vegard Murvold Sporstøl's avatar Vegard Murvold Sporstøl
Browse files

inital test for user registration

parent ec4c907e
No related branches found
No related tags found
1 merge request!7Task3
Pipeline #113566 passed
import json
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from users.serializers import UserSerializer
from users.models import User
from django.test import TestCase
# Create your tests here.
class RegistrationTestCase(APITestCase):
def test_registration(self):
data = {"username": "testcase", "email": "test@test.no",
"password": "strong_pwd", "password1": "strong_pwd",
"phone_number": "95080764", "country": "Norway",
"city": "Trondheim", "street_address": "Tors Veg 11C"}
response = self.client.post("/api/users/", data)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment