diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 10062643..578a12d9 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -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), ): diff --git a/tests/integration/test_error_handling_edge_cases.py b/tests/integration/test_error_handling_edge_cases.py index 4a7c5d18..b6755934 100644 --- a/tests/integration/test_error_handling_edge_cases.py +++ b/tests/integration/test_error_handling_edge_cases.py @@ -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( diff --git a/tests/integration/test_example.py b/tests/integration/test_example.py index ff611122..e4c025ac 100644 --- a/tests/integration/test_example.py +++ b/tests/integration/test_example.py @@ -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 diff --git a/tests/integration/test_general_info_endpoints.py b/tests/integration/test_general_info_endpoints.py index 907db5a4..05d0eb41 100644 --- a/tests/integration/test_general_info_endpoints.py +++ b/tests/integration/test_general_info_endpoints.py @@ -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