fix customer view and edit
This commit is contained in:
1 parent
81335b1439
commit
d5c22a39dc
13 files changed
+329
-81
No files matched your search
+6
-3
@@ -10,7 +10,7 @@ from apps.tickets.models import Ticket, TicketCategory
|
||||
from apps.tickets.services import create_ticket, claim_ticket, reply_ticket
|
||||
from apps.messaging.models import Message,MessageReadReceipt
|
||||
from apps.notifications.models import NotificationJob
|
||||
from apps.customers.models import CustomerProfile
|
||||
from apps.customers.models import ContactEditLog, CustomerProfile
|
||||
from apps.core.persian_text import normalize_persian_text
|
||||
|
||||
@pytest.mark.django_db
|
||||
@@ -664,7 +664,8 @@ def test_staff_customer_directory_search_and_ticket_stats(client):
|
||||
response=client.get(legacy.url)
|
||||
content=response.content.decode()
|
||||
assert response.status_code==200 and "زهرا محمدی" in content and "09121234567" in content
|
||||
assert "کل تیکت" in content and "نیازمند اقدام" in content
|
||||
assert "تیکت قابل مشاهده" in content and "نیازمند اقدام" in content
|
||||
assert response.context["contacts"][0].ticket_count == 0
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_staff_customer_live_search_returns_profile_data(client):
|
||||
@@ -687,9 +688,11 @@ def test_staff_create_uses_existing_customer_selected_by_public_id(client):
|
||||
StaffProfile.objects.create(user=expert,display_name="کارشناس انتخاب")
|
||||
expert.user_permissions.add(Permission.objects.get(content_type__app_label="tickets",codename="add_ticket"))
|
||||
client.force_login(expert)
|
||||
response=client.post(reverse("staff_tickets:create"),{"customer_id":customer.public_id,"customer_mobile":"09125550000","category":category.pk,"subject":"پیگیری مشتری موجود","province":"گیلان","city":"رشت","body":"شرح کامل پیگیری"})
|
||||
response=client.post(reverse("staff_tickets:create"),{"customer_id":customer.public_id,"customer_mobile":"09125550000","first_name":"مریم تازه","category":category.pk,"subject":"پیگیری مشتری موجود","province":"گیلان","city":"رشت","body":"شرح کامل پیگیری"})
|
||||
assert response.status_code==302
|
||||
assert customer.customer_tickets.filter(subject="پیگیری مشتری موجود").exists()
|
||||
log = ContactEditLog.objects.get(contact__user=customer, actor=expert)
|
||||
assert {"field": "نام", "before": "مریم", "after": "مریم تازه"} in log.changes
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_staff_create_requires_name_for_unknown_mobile(client):
|
||||
|
||||
Reference in new issue
Block a user