fix sms and ticket user frindly

This commit is contained in:
javad committed 2026-09-14 15:48:13 +03:30
1 parent 1ee83374fd
commit b8b3aba855
30 files changed
+2220 -119

No files matched your search

+34 -2
View File
@@ -6,7 +6,7 @@ from django.urls import reverse
from django.utils import timezone
from apps.accounts.models import User
from apps.staff.models import OrganizationalUnit, StaffProfile
from apps.tickets.models import TicketCategory
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.customers.models import CustomerProfile
@@ -112,10 +112,42 @@ def test_new_ticket_page_has_expert_cards_voice_and_file_preview(client):
client.force_login(customer)
content = client.get(reverse("tickets:new"),{"unit":unit.pk}).content.decode()
assert "کارشناس نمونه" in content
assert "data-voice-recorder" in content
assert "data-ticket-voice-recorder" in content
assert "data-file-preview" in content
assert "data-ticket-wizard" in content
assert "customer-ticket-wizard.js" in content
assert reverse("tickets:expert_avatar", args=[expert.public_id]) in content
@pytest.mark.django_db
def test_customer_ticket_wizard_keeps_server_validation_and_submitted_values(client):
unit = OrganizationalUnit.objects.create(name="واحد اعتبارسنجی مرحله‌ای", slug="wizard-validation-unit")
category = TicketCategory.objects.create(unit=unit, title="دسته مرحله‌ای", slug="wizard-validation-category")
customer = User.objects.create_user(
username="wizard-validation-customer",
mobile="09126666001",
account_type="CUSTOMER",
)
client.force_login(customer)
response = client.post(
reverse("tickets:new"),
{
"unit": unit.pk,
"category": category.pk,
"subject": "موضوع حفظ‌شده پس از خطای سرور",
"province": "",
"city": "",
"selected_expert": "",
"body": "",
},
)
assert response.status_code == 200
assert "متن یا پیوست الزامی است." in response.context["form"].non_field_errors()
content = response.content.decode()
assert "data-step-server-errors" in content
assert "موضوع حفظ‌شده پس از خطای سرور" in content
assert not Ticket.objects.filter(subject="موضوع حفظ‌شده پس از خطای سرور").exists()
@pytest.mark.django_db
def test_profile_location_prefills_ticket_but_can_be_overridden_per_ticket(client):
unit=OrganizationalUnit.objects.create(name="فروش تست موقعیت",slug="location-sales")