import pytest
from app.tests.conftest import headers
@pytest.mark.asyncio
async def test_merchant_lifecycle(client):
    await client.post("/api/v1/tenant-bundles",headers=headers(),json={"bundle_code":"payment.torbat_pay.merchant","is_active":True})
    m=(await client.post("/api/v1/merchant-accounts",headers=headers(),json={"name":"Merchant"})).json()
    m=(await client.post(f"/api/v1/merchant-accounts/{m['id']}/submit",headers=headers())).json(); assert m["status"]=="pending_review"
    m=(await client.post(f"/api/v1/merchant-accounts/{m['id']}/activate",headers=headers())).json(); assert m["status"]=="active"
    m=(await client.post(f"/api/v1/merchant-accounts/{m['id']}/suspend",headers=headers())).json(); assert m["status"]=="suspended"
