Server backup 2026-11-07 of uncommitted work in projects/pharma-web-celtic

Snapshot of the working tree on srv1071960 (branch main), taken during
server cleanup. .env files, node_modules, builds, logs and media were excluded.
This commit is contained in:
Shubhankar45
2026-11-07 05:43:12 +00:00
parent b001e2d03c
commit 0d30c58bf0
98 changed files with 1878 additions and 573 deletions
+32 -1
View File
@@ -1,4 +1,4 @@
"""A doctor or chemist an MR adds waits for their Area Manager; a doctor visit records a gift."""
"""A doctor, chemist or stockist an MR adds waits for their Area Business Manager; a doctor visit records a gift."""
from datetime import date
@@ -80,6 +80,37 @@ class TestAnMrsChemistWaitsToo:
assert "New Pharmacy" in await _names(client, auth["mr1"], "/chemists")
class TestAnMrsStockistWaitsToo:
async def _add(self, client, auth, org, who="mr1"):
resp = await client.post(
f"{API}/stockists", headers=auth[who],
json={"headquarters_id": str(org["hq1"].id), "name": "New Distributors", "address": "Unit 4, Bhubaneswar"},
)
assert resp.status_code == 201, resp.text
return resp.json()
async def test_it_is_pending_until_the_area_manager_approves(self, client, auth, org):
stockist = await self._add(client, auth, org)
assert stockist["approval_status"] == "PENDING" and stockist["requested_by_name"] == "Ravi Das"
assert "New Distributors" not in await _names(client, auth["mr1"], "/stockists")
assert await _names(client, auth["mr1"], "/stockists/requests") == ["New Distributors"]
assert await _names(client, auth["am1"], "/stockists/requests") == ["New Distributors"]
assert await _names(client, auth["am2"], "/stockists/requests") == []
assert (await client.post(f"{API}/stockists/{stockist['id']}/approve", headers=auth["am2"])).status_code == 403
assert (await client.post(f"{API}/stockists/{stockist['id']}/approve", headers=auth["am1"])).status_code == 200
assert "New Distributors" in await _names(client, auth["mr1"], "/stockists")
async def test_a_rejected_one_is_resent_by_adding_it_again(self, client, auth, org):
stockist = await self._add(client, auth, org)
rejected = await client.post(f"{API}/stockists/{stockist['id']}/reject", headers=auth["am1"], json={"reason": "Duplicate"})
assert rejected.status_code == 200 and rejected.json()["rejection_reason"] == "Duplicate"
again = await self._add(client, auth, org)
assert again["id"] == stockist["id"] and again["approval_status"] == "PENDING"
async def test_the_admins_own_stockist_is_approved_at_once(self, client, auth, org):
assert (await self._add(client, auth, org, who="admin"))["approval_status"] == "APPROVED"
class TestGift:
async def test_a_doctor_visit_records_the_gift_and_the_pdf_notes_it(self, client, auth, org, approved_plan):
doctor = await _add_doctor(client, auth, org, who="admin", name="Dr Gifted")