Expand sales leads and customer contracts
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
import services.sales_service.app as sales_module
|
||||
|
||||
|
||||
@@ -22,10 +24,73 @@ def test_sales_frontend_contract_routes_are_registered():
|
||||
"/api/v1/deals/{deal_id}/conditions": {"GET", "POST", "PATCH", "PUT"},
|
||||
"/api/v1/deals/{deal_id}/conditions/confirm": {"POST"},
|
||||
"/api/v1/deals/{deal_id}/escalations": {"GET", "POST"},
|
||||
"/api/v1/automation-tasks": {"GET"},
|
||||
"/api/v1/deals/{deal_id}/automation-tasks": {"GET"},
|
||||
"/api/v1/automation-tasks/{task_id}/cancel": {"POST"},
|
||||
"/api/v1/automation-tasks/{task_id}/run-now": {"POST"},
|
||||
"/api/v1/leads": {"GET", "POST"},
|
||||
"/api/v1/leads/{lead_id}": {"GET", "PATCH"},
|
||||
"/api/v1/leads/{lead_id}/enrich": {"POST"},
|
||||
"/api/v1/leads/{lead_id}/convert-to-deal": {"POST"},
|
||||
"/api/v1/customers": {"GET"},
|
||||
"/api/v1/customers/{customer_id}": {"GET", "PATCH"},
|
||||
"/api/v1/customers/{customer_id}/deals": {"GET"},
|
||||
"/api/v1/customers/{customer_id}/communications": {"GET"},
|
||||
"/api/v1/customers/{customer_id}/documents": {"GET"},
|
||||
"/api/v1/customers/{customer_id}/invoices": {"GET"},
|
||||
"/api/v1/customers/{customer_id}/payments": {"GET"},
|
||||
}
|
||||
|
||||
for path, methods in expected.items():
|
||||
assert methods.issubset(_methods(path))
|
||||
|
||||
|
||||
def test_tenant_automation_tasks_route_accepts_registry_filters():
|
||||
client = TestClient(sales_module.app)
|
||||
response = client.get(
|
||||
"/api/v1/automation-tasks",
|
||||
params={
|
||||
"status": "pending",
|
||||
"run_at": "future",
|
||||
"pending_only": "true",
|
||||
"deal_search": "demo",
|
||||
},
|
||||
headers={"X-User": "admin", "X-Role": "admin", "X-Tenant-ID": "tenant_contract"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
|
||||
|
||||
def test_leads_route_accepts_registry_filters():
|
||||
client = TestClient(sales_module.app)
|
||||
response = client.get(
|
||||
"/api/v1/leads",
|
||||
params={
|
||||
"search": "demo",
|
||||
"status": "new_qualified_lead",
|
||||
"lead_temperature": "warm",
|
||||
"source_channel": "telegram",
|
||||
"source_type": "crm",
|
||||
"customer_type": "b2b",
|
||||
"preferred_channel": "telegram",
|
||||
"limit": "25",
|
||||
"offset": "0",
|
||||
},
|
||||
headers={"X-User": "admin", "X-Role": "admin", "X-Tenant-ID": "tenant_contract"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
|
||||
|
||||
def test_customers_route_accepts_registry_filters():
|
||||
client = TestClient(sales_module.app)
|
||||
response = client.get(
|
||||
"/api/v1/customers",
|
||||
params={"search": "demo", "limit": "25", "offset": "0"},
|
||||
headers={"X-User": "admin", "X-Role": "admin", "X-Tenant-ID": "tenant_contract"},
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert isinstance(response.json(), list)
|
||||
|
||||
Reference in New Issue
Block a user