Mint API: Check ?amount is within a sensible range (#226)

This commit is contained in:
Angus Pearson
2023-05-18 21:31:20 +01:00
committed by GitHub
parent 5f3f88c8ed
commit e25100c1e0
2 changed files with 14 additions and 0 deletions

View File

@@ -42,3 +42,15 @@ async def test_api_keyset_keys(ledger):
assert response.json() == {
str(k): v.serialize().hex() for k, v in ledger.keyset.public_keys.items()
}
@pytest.mark.asyncio
async def test_api_mint_validation(ledger):
response = requests.get(f"{BASE_URL}/mint?amount=-21")
assert "error" in response.json()
response = requests.get(f"{BASE_URL}/mint?amount=0")
assert "error" in response.json()
response = requests.get(f"{BASE_URL}/mint?amount=2100000000000001")
assert "error" in response.json()
response = requests.get(f"{BASE_URL}/mint?amount=1")
assert "error" not in response.json()