40 lines
2.0 KiB
Python
40 lines
2.0 KiB
Python
import requests
|
|
|
|
s = requests.Session()
|
|
|
|
# 1. Login as admin
|
|
login_res = s.post('http://127.0.0.1:5000/login', json={'username': 'dmh', 'password': 'dmh123'})
|
|
assert login_res.status_code == 200, f"Login failed: {login_res.text}"
|
|
print("✅ Admin login successful")
|
|
|
|
# 2. Get /admin
|
|
admin_res = s.get('http://127.0.0.1:5000/admin')
|
|
assert admin_res.status_code == 200, f"Failed to get /admin: {admin_res.status_code}"
|
|
html = admin_res.text
|
|
|
|
# 3. Check for PO summary cards
|
|
assert 'PO Approvals Today' in html, "Missing 'PO Approvals Today' summary card"
|
|
assert 'Total PO Approvals' in html, "Missing 'Total PO Approvals' summary card"
|
|
assert 'Item Code Approvals' in html, "Missing 'Item Code Approvals' summary card"
|
|
print("✅ Verified: PO summary KPI cards present in Daily Audit")
|
|
|
|
# 4. Check for PO columns in daily operator audit table
|
|
assert 'PO Approvals' in html, "Missing 'PO Approvals' table header"
|
|
assert 'Item Approvals' in html, "Missing 'Item Approvals' table header"
|
|
print("✅ Verified: PO columns present in Daily Operator audit breakdown")
|
|
|
|
# 5. Check for PO Activity History sub-table
|
|
assert 'PO & Item Code Activity History' in html or 'PO & Item Code Activity History' in html, "Missing PO & Item Code Activity History section"
|
|
assert 'INV-E2E-C4-101' in html, "Missing historical invoice INV-E2E-C4-101 in PO activity history"
|
|
assert 'PO-DMH-998877' in html, "Missing approved PO number in history"
|
|
assert 'E2E Pharma Corp' in html, "Missing vendor name in history"
|
|
print("✅ Verified: PO & Item Code Activity History table displays real audit records seamlessly")
|
|
|
|
# 6. Check that technical condition names do NOT appear
|
|
assert 'Condition 4 & 5' not in html, "Found internal Condition 4 & 5 text!"
|
|
assert 'Condition 3 & 5' not in html, "Found internal Condition 3 & 5 text!"
|
|
assert 'Condition 4:' not in html, "Found internal Condition 4: text in notes!"
|
|
print("✅ Verified: No internal condition jargon exposed in UI")
|
|
|
|
print("\n🎉 ALL DAILY AUDIT PO TESTS PASSED 100%!")
|