Files
qlockify-backend-deployment/apps/users/tests/test_profile_picture_api.py

19 lines
637 B
Python

from rest_framework import status
from rest_framework.test import APITestCase
from apps.users.models import 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 = self.client.delete("/api/users/profile/picture/")
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertIsNone(response.data["profile_picture"])
user.refresh_from_db()
self.assertFalse(user.profile_picture)