This commit is contained in:
javad committed 2026-10-10 14:21:04 +03:30
1 parent 250cdbab7f
commit 5c6069c3ef
87 files changed
+29209 -3697

No files matched your search

+30 -2
View File
@@ -14,8 +14,8 @@ from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from admin_panel.models import (Action, Article, Factor, Sarresid,
StoreTransferRequest)
from admin_panel.models import (Action, Article, Factor, PhoneNumber, Sarresid,
SMSQueue, SMSTemplate, StoreTransferRequest)
from .factories import (make_category, make_customer, make_product, make_store,
make_user, stock_in)
@@ -67,6 +67,18 @@ class ViewSmokeTests(TestCase):
product=cls.product, quantity=1, requester=cls.user,
)
# --- پیامک ---
cls.phone = PhoneNumber.objects.create(
customer=cls.customer, title='موبایل', phone_number='09120000000',
)
cls.customer.sms_primary_phones = '+989120000000'
cls.customer.save(update_fields=['sms_primary_phones'])
cls.sms_template = SMSTemplate.objects.get(sms_type='welcome')
cls.sms_queue = SMSQueue.objects.create(
customer=cls.customer, sms_type='welcome',
phone_number='+989120000000', message='دودی', status='failed',
)
def setUp(self):
self.client.force_login(self.user)
# در صورت خطای سرور، استثنا را نگه می‌داریم تا کد وضعیت ۵۰۰ را ببینیم
@@ -198,6 +210,22 @@ class ViewSmokeTests(TestCase):
}),
('api_check_status_inquiry', {}, GET, None),
('api_check_sabt_inquiry', {}, GET, None),
# --- پیامک ---
('sms_settings', {}, GET, None),
('sms_templates', {}, GET, None),
('sms_template_edit', {'t_id': self.sms_template.id}, POST, {
'title': 'عنوان دودی', 'text': 'متن دودی',
'timing_value': '2',
}),
('sms_customer_toggle', {'c_id': c.id}, POST, {
'sms_type': 'welcome', 'is_enabled': 'false',
}),
('sms_primary_toggle', {'c_id': c.id}, POST, {
'phone': '09120000000', 'is_primary': 'true',
}),
('sms_send_custom', {'c_id': c.id}, POST, {'text': 'پیامک دودی'}),
('sms_queue', {}, GET, None),
('sms_queue_retry', {'q_id': self.sms_queue.id}, POST, None),
# در انتهای لیست: خروج از حساب، چون بعد از آن تمام درخواست‌ها بی‌اعتبار می‌شوند
('p_logout', {}, GET, None),
]