2023-10-24 12:28:42 -04:00
|
|
|
from django.test import TestCase
|
2023-10-29 16:09:38 -04:00
|
|
|
from django.http import HttpResponse, HttpRequest
|
|
|
|
from django.contrib.auth.models import User
|
2023-10-24 12:28:42 -04:00
|
|
|
|
|
|
|
# Create your tests here.
|
2023-10-29 16:09:38 -04:00
|
|
|
class ProfileTest(TestCase):
|
|
|
|
def setUp(self):
|
|
|
|
self.user: User = User.objects.create(username='bozo', password='password')
|
|
|
|
self.user.save()
|
2023-11-11 18:03:08 -05:00
|
|
|
self.expected_response = {"name": "bozo",
|
2023-10-29 16:09:38 -04:00
|
|
|
"title": ""}
|
2023-11-11 18:03:08 -05:00
|
|
|
self.url = "/profiles/"
|
2023-10-29 16:09:38 -04:00
|
|
|
|
|
|
|
def test_profile_create_on_user_created(self):
|
2023-11-11 18:03:08 -05:00
|
|
|
response: HttpResponse = self.client.get(self.url + str(self.user.pk))
|
2023-10-29 16:09:38 -04:00
|
|
|
response_dict: dict = eval(response.content)
|
2023-11-11 18:03:08 -05:00
|
|
|
self.assertDictEqual(self.expected_response, response_dict)
|
2023-10-29 16:09:38 -04:00
|
|
|
|