-
Notifications
You must be signed in to change notification settings - Fork 0
[MPT-14913] Added e2e tests for journal charges #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MPT-14913] Added e2e tests for journal charges #185
Conversation
📝 WalkthroughWalkthroughUpdated billing journal identifiers and test data; added fixtures and two new end-to-end test modules (async and sync) for billing journal charge operations. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
523e311 to
92f8042
Compare
92f8042 to
4d70046
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/e2e/billing/journal/charge/test_sync_journal_charge.py (1)
25-30: Consider verifying pagination limit is respected.The test validates that results are returned but doesn't verify the pagination limit. While the current assertion is sufficient for e2e testing, you could optionally add a check that
len(result) <= limitto ensure pagination works correctly.♻️ Optional enhancement
def test_list_journal_charges(journal_charges): limit = 10 result = journal_charges.fetch_page(limit=limit) assert len(result) > 0 + assert len(result) <= limit
📜 Review details
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
tests/data/test_billing_journal.xlsxis excluded by!**/*.xlsx
📒 Files selected for processing (5)
e2e_config.test.jsontests/data/test_billing_journal.jsonltests/e2e/billing/journal/charge/conftest.pytests/e2e/billing/journal/charge/test_async_journal_charge.pytests/e2e/billing/journal/charge/test_sync_journal_charge.py
🚧 Files skipped from review as they are similar to previous changes (3)
- tests/data/test_billing_journal.jsonl
- tests/e2e/billing/journal/charge/conftest.py
- tests/e2e/billing/journal/charge/test_async_journal_charge.py
🧰 Additional context used
📓 Path-based instructions (2)
**/*
⚙️ CodeRabbit configuration file
**/*: For each subsequent commit in this PR, explicitly verify if previous review comments have been resolved
Files:
tests/e2e/billing/journal/charge/test_sync_journal_charge.pye2e_config.test.json
**/*.py
⚙️ CodeRabbit configuration file
**/*.py: Follow the linting rules defined in pyproject.toml under [tool.ruff] and [tool.flake8] sections.
For formatting, use Ruff instead of Black. Do not suggest Black formatting changes.
Files:
tests/e2e/billing/journal/charge/test_sync_journal_charge.py
🧠 Learnings (3)
📚 Learning: 2026-01-08T08:34:05.465Z
Learnt from: albertsola
Repo: softwareone-platform/mpt-api-python-client PR: 183
File: tests/e2e/catalog/price_lists/conftest.py:29-30
Timestamp: 2026-01-08T08:34:05.465Z
Learning: In end-to-end tests (e.g., tests/e2e/...), reuse existing API resources for read-only operations and safe mutations to speed up test execution. Reserve isolated fixtures (e.g., created_price_list) for destructive tests that require per-test creation and cleanup. Ensure tests document when a fixture creates/destroys data and clearly indicate which operations are destructive, so tests stay fast and properly isolated.
Applied to files:
tests/e2e/billing/journal/charge/test_sync_journal_charge.py
📚 Learning: 2025-12-12T15:02:20.732Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 160
File: tests/e2e/commerce/agreement/attachment/test_async_agreement_attachment.py:55-58
Timestamp: 2025-12-12T15:02:20.732Z
Learning: In pytest with pytest-asyncio, if a test function uses async fixtures but contains no await, declare the test function as def (synchronous) instead of async def. Pytest-asyncio will resolve the async fixtures automatically; this avoids linter complaints about unnecessary async functions. This pattern applies to any test file under the tests/ directory that uses such fixtures.
Applied to files:
tests/e2e/billing/journal/charge/test_sync_journal_charge.py
📚 Learning: 2026-01-08T23:38:19.565Z
Learnt from: robcsegal
Repo: softwareone-platform/mpt-api-python-client PR: 186
File: tests/e2e/billing/ledger/charge/test_sync_ledger_charge.py:33-39
Timestamp: 2026-01-08T23:38:19.565Z
Learning: In Python e2e tests under tests/e2e, hardcoded external IDs (e.g., INV12345) are intentional because they come from seeded test data. Ensure the test data seeds consistently include these IDs; if seeds change, update tests accordingly. Prefer using a named constant for such IDs (e.g., INV_EXTERNAL_ID) and document the dependency on seed data to avoid brittle tests.
Applied to files:
tests/e2e/billing/journal/charge/test_sync_journal_charge.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (6)
tests/e2e/billing/journal/charge/test_sync_journal_charge.py (5)
1-6: LGTM!Imports and test markers are properly configured for end-to-end testing.
9-11: LGTM!The fixture correctly constructs the journal charges endpoint from the billing journal ID, following the established pattern for e2e test fixtures.
14-18: LGTM!Basic retrieval test is correctly implemented.
20-22: LGTM!Error handling test correctly validates 404 Not Found behavior.
33-43: No changes needed. The hardcoded"INV12345"is intentional and comes from the seeded test data (verified intest_billing_journal.jsonl). This pattern is consistent across all similar e2e tests (both journal and ledger, sync and async variants) and aligns with the project's approach to e2e testing where hardcoded values from import files are guaranteed to exist.e2e_config.test.json (1)
19-22: Verify that journal and ledger charge IDs are intentionally identical.Lines 19 and 22 both reference the same charge ID (
CHG-2589-1434-0000-0000-0200) for different entities:
billing.journal.charge.id(line 19)billing.ledger.charge.id(line 22)This is inconsistent with the pattern elsewhere in the config:
billing.custom_ledger.charge.id(line 16) uses a distinct ID (CHG-2665-3524-0000-0000-0020). Additionally, the parent entities themselves have different IDs (billing.journal.idvsbilling.ledger.id), and they are tested in separate modules (tests/e2e/billing/journal/charge/andtests/e2e/billing/ledger/charge/). If these represent distinct journal and ledger charges, using the same ID may prevent tests from properly validating entity-specific behavior.⛔ Skipped due to learnings
Learnt from: robcsegal Repo: softwareone-platform/mpt-api-python-client PR: 186 File: tests/e2e/billing/ledger/charge/test_sync_ledger_charge.py:33-39 Timestamp: 2026-01-08T23:38:26.691Z Learning: In the mpt-api-python-client e2e tests, hardcoded values like "INV12345" for invoice external IDs are intentional and guaranteed to exist because they come from import files used to seed the test data.
|



Added e2e tests for journal charges.
Had to reseed and recreate journal information after platform fix.
https://softwareone.atlassian.net/browse/MPT-14913
Closes MPT-14913