fix(users): support profile picture delete and dev sms fallback

This commit is contained in:
2026-04-24 22:20:13 +03:30
parent 7cae494892
commit a44995017b
4 changed files with 52 additions and 4 deletions

View File

@@ -0,0 +1,18 @@
from rest_framework import status
from rest_framework.test import APIClient
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)
response = client.delete("/api/users/profile/picture/")
assert response.status_code == status.HTTP_200_OK
assert response.data["profile_picture"] is None
user.refresh_from_db()
assert not user.profile_picture

View File

@@ -0,0 +1,13 @@
from apps.users.tasks import send_verification_sms
def test_send_verification_sms_skips_real_delivery_without_api_key(settings):
settings.SMS_APIKEY = ""
result = send_verification_sms("09123456789", "12345")
assert result == {
"mobile": "09123456789",
"code": "12345",
"sent": False,
}