test(backend): convert existing app suites to unittest

This commit is contained in:
2026-04-30 12:41:54 +03:30
parent 204225dd16
commit 8774a4d4dc
16 changed files with 1785 additions and 1780 deletions

View File

@@ -1,18 +1,18 @@
from rest_framework import status
from rest_framework.test import APIClient
from rest_framework.test import APITestCase
from apps.users.models import User
def test_profile_picture_delete_returns_profile_payload(db):
user = User.objects.create_user(mobile="09120000000", password="secret123")
client = APIClient()
client.force_authenticate(user=user)
class ProfilePictureApiTests(APITestCase):
def test_profile_picture_delete_returns_profile_payload(self):
user = User.objects.create_user(mobile="09120000000", password="secret123")
self.client.force_authenticate(user=user)
response = client.delete("/api/users/profile/picture/")
response = self.client.delete("/api/users/profile/picture/")
assert response.status_code == status.HTTP_200_OK
assert response.data["profile_picture"] is None
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIsNone(response.data["profile_picture"])
user.refresh_from_db()
assert not user.profile_picture
user.refresh_from_db()
self.assertFalse(user.profile_picture)