profiles: friends reworked

This commit is contained in:
AdrienLSH
2024-04-09 13:12:15 +02:00
parent 9f5ca1430d
commit 90d179eb72
6 changed files with 80 additions and 36 deletions

View File

@ -0,0 +1,16 @@
from django.test import TestCase
from django.http import HttpResponse
from django.contrib.auth.models import User
class ProfileTest(TestCase):
def setUp(self):
self.user: User = User.objects.create_user('bozo', password='password')
self.user.save()
self.expected_response = {'avatar': '/static/avatars/default.avif', 'user_id': 1, 'username': 'bozo'}
self.url = "/api/profiles/user/"
def test_profile_create_on_user_created(self):
response: HttpResponse = self.client.get(self.url + self.user.username)
self.assertDictEqual(self.expected_response, response.json())