ft_transcendence/srcs/profiles/tests.py

18 lines
706 B
Python
Raw Permalink Normal View History

2023-11-23 10:43:30 -05:00
from django.test import TestCase
from django.http import HttpResponse, HttpRequest
from django.contrib.auth.models import User
# Create your tests here.
class ProfileTest(TestCase):
def setUp(self):
self.user: User = User.objects.create(username='bozo', password='password')
self.user.save()
self.expected_response = {"name": "bozo",
"title": ""}
self.url = "/profiles/"
def test_profile_create_on_user_created(self):
response: HttpResponse = self.client.get(self.url + str(self.user.pk))
response_dict: dict = eval(response.content)
self.assertDictEqual(self.expected_response, response_dict)