fix(users): support profile picture delete and dev sms fallback
This commit is contained in:
18
apps/users/tests/test_profile_picture_api.py
Normal file
18
apps/users/tests/test_profile_picture_api.py
Normal 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
|
||||
13
apps/users/tests/test_tasks.py
Normal file
13
apps/users/tests/test_tasks.py
Normal 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,
|
||||
}
|
||||
Reference in New Issue
Block a user