Production

This commit is contained in:
Shubhankar45
2026-09-22 06:23:46 +00:00
commit 8fdd20b29f
217 changed files with 31212 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
import pytest
from sqlalchemy import text
pytestmark = pytest.mark.anyio
API = "/api/v1"
async def test_am_can_list_only_approval_csv_tables_and_download_approval_pdf(client, auth, db):
await db.execute(
text(
'''
CREATE TABLE IF NOT EXISTS "fare_chart" (
id UUID PRIMARY KEY,
source_row_number INTEGER,
name TEXT,
headquarter TEXT,
serial_no TEXT,
report_date TEXT,
from_location TEXT,
to_location TEXT,
kilometers_km TEXT,
owner_user_id UUID
)
'''
)
)
await db.commit()
resp = await client.get(f"{API}/csv-data/tables", headers=auth["am1"])
assert resp.status_code == 200, resp.text
table_names = {item["name"] for item in resp.json()}
assert table_names == {"standard_tour_plan", "tour_plan", "fare_chart"}
assert "daily_call_report_csv" not in table_names
pdf = await client.get(f"{API}/csv-data/fare_chart/pdf", headers=auth["am1"])
assert pdf.status_code == 200, pdf.text
assert pdf.headers["content-type"].startswith("application/pdf")