add proper validation for the unit field when creating an invoice (#2647)
This commit is contained in:
parent
405a2f0776
commit
4732c4b296
2 changed files with 25 additions and 1 deletions
|
|
@ -150,6 +150,21 @@ async def test_create_invoice_fiat_amount(client, inkey_headers_to):
|
|||
assert extra["fiat_rate"]
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
@pytest.mark.parametrize("currency", ("msat", "RRR"))
|
||||
async def test_create_invoice_validates_used_currency(
|
||||
currency, client, inkey_headers_to
|
||||
):
|
||||
data = await get_random_invoice_data()
|
||||
data["unit"] = currency
|
||||
response = await client.post(
|
||||
"/api/v1/payments", json=data, headers=inkey_headers_to
|
||||
)
|
||||
assert response.status_code == 400
|
||||
res_data = response.json()
|
||||
assert "The provided unit is not supported" in res_data["detail"]
|
||||
|
||||
|
||||
# check POST /api/v1/payments: invoice creation for internal payments only
|
||||
@pytest.mark.asyncio
|
||||
async def test_create_internal_invoice(client, inkey_headers_to):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue