mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-06 04:38:22 +00:00
test fixes
This commit is contained in:
@@ -226,7 +226,7 @@ class TestmintWallet:
|
||||
# For testing, create a refund token
|
||||
return await self.mint_tokens(amount)
|
||||
|
||||
async def send_token(self, amount: int, unit: str, mint_url: str = None) -> str:
|
||||
async def send_token(self, amount: int, unit: str, mint_url: Optional[str] = None) -> str:
|
||||
"""Send token with compatible signature for mocking router.wallet.send_token"""
|
||||
return await self.send(amount)
|
||||
|
||||
@@ -275,7 +275,9 @@ class TestmintWallet:
|
||||
return amount_msat
|
||||
except Exception as e:
|
||||
print(f"ERROR: credit_balance failed: {e}")
|
||||
raise
|
||||
import traceback
|
||||
print(f"ERROR: Full traceback: {traceback.format_exc()}")
|
||||
raise ValueError(f"Failed to redeem token: {str(e)}")
|
||||
|
||||
|
||||
@pytest_asyncio.fixture
|
||||
@@ -472,6 +474,7 @@ async def integration_app(
|
||||
patch("router.wallet.PRIMARY_MINT_URL", "http://mint:3338"),
|
||||
patch("router.auth.credit_balance", testmint_wallet.credit_balance),
|
||||
patch("router.wallet.credit_balance", testmint_wallet.credit_balance),
|
||||
patch("router.balance.credit_balance", testmint_wallet.credit_balance),
|
||||
patch("router.wallet.send_token", testmint_wallet.send_token),
|
||||
patch("router.balance.send_token", testmint_wallet.send_token),
|
||||
):
|
||||
|
||||
@@ -179,7 +179,9 @@ class TestInvalidInputHandling:
|
||||
|
||||
# All should fail with 400
|
||||
assert response.status_code == 400, f"Token {repr(token)} should fail"
|
||||
assert "invalid" in response.json()["detail"].lower()
|
||||
# Accept various error messages that indicate token validation failure
|
||||
error_detail = response.json()["detail"].lower()
|
||||
assert any(keyword in error_detail for keyword in ["invalid", "failed to redeem", "failed to decode"]), f"Unexpected error message: {error_detail}"
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_invalid_json_payloads(
|
||||
|
||||
@@ -89,6 +89,9 @@ async def test_full_wallet_flow(
|
||||
"/v1/wallet/topup", params={"cashu_token": topup_token}
|
||||
)
|
||||
|
||||
if topup_response.status_code != 200:
|
||||
print(f"ERROR: Topup failed with status {topup_response.status_code}")
|
||||
print(f"ERROR: Response body: {topup_response.json()}")
|
||||
assert topup_response.status_code == 200
|
||||
assert topup_response.json()["msats"] == topup_amount * 1000
|
||||
|
||||
|
||||
@@ -105,8 +105,8 @@ async def test_root_endpoint_environment_variables(
|
||||
data = response.json()
|
||||
|
||||
# Check that environment variables are reflected in response
|
||||
# These are set in conftest.py
|
||||
assert "https://mint.minibits.cash/Bitcoin" in data["mints"]
|
||||
# These are set in conftest.py for test environment
|
||||
assert "http://mint:3338" in data["mints"]
|
||||
|
||||
# Name should have a default value or be configurable
|
||||
assert len(data["name"]) > 0
|
||||
|
||||
Reference in New Issue
Block a user