test: restructure tests (#2444)

unit, api, wallets
* only run test-api for migration
This commit is contained in:
dni ⚡
2024-04-19 13:22:06 +02:00
committed by GitHub
parent 67fdb77339
commit e607ab7a3e
21 changed files with 605 additions and 563 deletions
+26
View File
@@ -0,0 +1,26 @@
import pytest
# check if the client is working
@pytest.mark.asyncio
async def test_core_views_generic(client):
response = await client.get("/")
assert response.status_code == 200
# check GET /public/v1/payment/{payment_hash}: correct hash [should pass]
@pytest.mark.asyncio
async def test_api_public_payment_longpolling(client, invoice):
response = await client.get(f"/public/v1/payment/{invoice['payment_hash']}")
assert response.status_code < 300
assert response.json()["status"] == "paid"
# check GET /public/v1/payment/{payment_hash}: wrong hash [should fail]
@pytest.mark.asyncio
async def test_api_public_payment_longpolling_wrong_hash(client, invoice):
response = await client.get(
f"/public/v1/payment/{invoice['payment_hash'] + '0'*64}"
)
assert response.status_code == 404
assert response.json()["detail"] == "Payment does not exist."