import pytest
from app.tests.conftest import headers
@pytest.mark.asyncio
async def test_tenant_required(client):
    assert (await client.get("/api/v1/payment-workspaces")).status_code in (400,422)
@pytest.mark.asyncio
async def test_psp_secrets_redacted(client):
    await client.post("/api/v1/tenant-bundles",headers=headers(),json={"bundle_code":"payment.byo_psp.basic","is_active":True})
    r=await client.post("/api/v1/psp-connections",headers=headers(),json={"provider_code":"mock","credential_vault_ref":"vault://secret","secret_config":{"password":"x"}})
    assert r.json()["credential_vault_ref"]=="***REDACTED***" and "secret_config" not in r.json()
