Skip to content

feat: add integration tests for incoming payments - #15

Merged
adrianboros merged 1 commit into
interledger:mainfrom
3n3gma:main
Nov 26, 2026
Merged

adrianboros merged 1 commit into
interledger:mainfrom
3n3gma:main

Conversation

@3n3gma

@3n3gma 3n3gma commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

This PR adds integration tests for the incoming payments endpoints, addressing issue #5.

Tests added:

  • test_create_incoming_payment
  • test_get_incoming_payment
  • test_list_incoming_payments

All tests verified locally against the Interledger test server — 3 passed.

@COMPUMAX-EC COMPUMAX-EC left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up #5! I checked out this branch and ran the new tests locally (Windows, Python 3.14), and all 3 pass.

Looking closer, though, I don't think they exercise the incoming payment endpoints yet. All three tests only call op_client.wallet.get_wallet_address(...), which test_wallet.py already covers. test_create_incoming_payment builds an IncomingPaymentRequest but never sends it, and the get and list tests don't fetch any incoming payment.

A few suggestions:

  1. Call the SDK methods the tests are named after. Get an access token with op_client.grants.post_grant_request(...), as test_grants.py does with the grant_req_dto fixture. Then call op_client.incoming_payments.post_create_payment(...) with str(wallet.resourceServer), get_incoming_payment(...) with the returned id, and get_incoming_payments(...), and assert on the responses (for example walletAddress and incomingAmount).
  2. expiresAt="2026-12-31T23:59:59Z" will be in the past in a few weeks. Something like datetime.now(timezone.utc) + timedelta(days=1) would keep the test valid.
  3. The wallet URL is repeated three times. A fixture in conftest.py, like the existing wallet_address_server, would avoid that.
  4. Small things: import pytest is unused, and the file has no newline at the end.

One question: #11 mentions Pydantic validation errors on real responses, for example the required updatedAt field missing. Did you run into that when calling the incoming payment endpoints? If so, it may be worth mentioning here, or building on #12.

Also, CI currently runs only tests/unit/, so these integration tests won't run automatically on PRs.

@adrianboros

Copy link
Copy Markdown
Contributor

Thanks @3n3gma for picking up #5 and contributing a starting structure for incoming-payment integration coverage.

We’re proceeding with merging this contribution after #12 and #14, then extending it against the combined SDK. The current cases exercise wallet discovery and request construction; we’ll carry the endpoint-coverage improvements identified in the review into follow-up changes.

That work will:

  • Obtain the appropriate grants and actually create, retrieve, and list incoming payments, asserting on the returned resources.
  • Use configurable wallets and credentials, derive asset information from the wallet, and replace the fixed expiry date with a relative timestamp.
  • Cover pagination and relevant failure responses against the Open Payments v1.5.1 contracts.
  • Separate deterministic offline tests from explicitly enabled live integration tests and document how to run both.

We’ll keep #5 open until the intended endpoint coverage is complete. This contribution gives us a starting point for that coverage as we bring Python to parity with the other SDKs.

@adrianboros
adrianboros merged commit 3b89abf into interledger:main Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants