Files
routstr-core/tests/integration
2025-08-09 12:43:31 -03:00
..
2025-08-08 23:35:55 -04:00
2025-07-26 15:18:31 -04:00
2025-08-06 23:38:18 -04:00
2025-08-06 20:31:55 -03:00
2025-08-06 23:48:13 -04:00
2025-08-05 12:50:27 -03:00
2025-08-05 12:50:27 -03:00
2025-08-05 12:50:27 -03:00
2025-08-06 23:25:06 -03:00
2025-08-05 12:50:27 -03:00
2025-08-08 19:00:59 -04:00
2025-08-08 23:26:01 -04:00
2025-08-08 19:00:59 -04:00
2025-08-05 12:50:27 -03:00

Integration Tests

End-to-end tests for API endpoints, Cashu wallet operations, and database interactions.

Running Tests

# All integration tests
pytest tests/integration/ -v

# Specific test file
pytest tests/integration/test_wallet_topup.py -v

# Skip slow tests
pytest tests/integration/ -m "not slow" -v

Test Infrastructure

TestmintWallet - Mock Cashu wallet for generating test tokens DatabaseSnapshot - Captures database state changes
Test Utilities - Validators for responses, performance, and concurrency

Real Testmint Setup (Optional)

By default, tests use a mock testmint. For testing against a real instance:

./tests/integration/setup_testmint.sh
export USE_REAL_MINT=true
export MINT_URL=http://localhost:3338
pytest tests/integration/ -v

Writing Tests

@pytest.mark.integration
@pytest.mark.asyncio
async def test_wallet_topup(integration_client, testmint_wallet, db_snapshot):
    await db_snapshot.capture()
    token = await testmint_wallet.mint_tokens(1000)
    
    response = await integration_client.post(
        "/v1/wallet/topup", 
        params={"cashu_token": token}
    )
    
    assert response.status_code == 200
    diff = await db_snapshot.diff()
    assert len(diff["api_keys"]["added"]) == 1