Skip to content

Commit b2801fc

Browse files
authored
[MPT-14912] Add e2e tests for billing journal sellers (#188)
Add e2e tests for billing journal sellers https://softwareone.atlassian.net/browse/MPT-14912 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> Closes [MPT-14912](https://softwareone.atlassian.net/browse/MPT-14912) ## Release Notes - Add end-to-end test suite for billing journal sellers with both synchronous and asynchronous implementations - Add `test_list_journal_sellers` (sync & async) to verify listing sellers with pagination (limit=10) and non-empty results - Add `test_filter_journal_sellers` (sync & async) to verify filtering by seller ID and name, selecting fields (excludes `period` via "-period"), and asserting exactly one match - Add `journal_sellers` fixture (sync & async variants) exposing the sellers resource for a given billing journal (relies on seeded e2e config) - Mark modules with pytest flaky marker to handle intermittent test instability <!-- end of auto-generated comment: release notes by coderabbit.ai --> [MPT-14912]: https://softwareone.atlassian.net/browse/MPT-14912?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
2 parents d670c27 + 8605dd1 commit b2801fc

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import pytest
2+
3+
from mpt_api_client.rql.query_builder import RQLQuery
4+
5+
pytestmark = [pytest.mark.flaky]
6+
7+
8+
@pytest.fixture
9+
def journal_sellers(async_mpt_vendor, billing_journal_id):
10+
# Note: relies on seeded e2e config for `billing_journal_id`
11+
# (see e2e_config.test.json). Update seeds if this changes.
12+
return async_mpt_vendor.billing.journals.sellers(billing_journal_id)
13+
14+
15+
async def test_list_journal_sellers(journal_sellers):
16+
limit = 10
17+
18+
result = await journal_sellers.fetch_page(limit=limit)
19+
20+
assert len(result) > 0
21+
22+
23+
async def test_filter_journal_sellers(journal_sellers, seller_id):
24+
select_fields = ["-period"]
25+
filtered_sellers = (
26+
journal_sellers.filter(RQLQuery(id=seller_id))
27+
.filter(RQLQuery(name="E2E Seeded Seller"))
28+
.select(*select_fields)
29+
)
30+
31+
result = [seller async for seller in filtered_sellers.iterate()]
32+
33+
assert len(result) == 1
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import pytest
2+
3+
from mpt_api_client.rql.query_builder import RQLQuery
4+
5+
pytestmark = [pytest.mark.flaky]
6+
7+
8+
@pytest.fixture
9+
def journal_sellers(mpt_vendor, billing_journal_id):
10+
# Note: relies on seeded e2e config for `billing_journal_id`
11+
# (see e2e_config.test.json). Update seeds if this changes.
12+
return mpt_vendor.billing.journals.sellers(billing_journal_id)
13+
14+
15+
def test_list_journal_sellers(journal_sellers):
16+
limit = 10
17+
18+
result = journal_sellers.fetch_page(limit=limit)
19+
20+
assert len(result) > 0
21+
22+
23+
def test_filter_journal_sellers(journal_sellers, seller_id):
24+
select_fields = ["-period"]
25+
filtered_sellers = (
26+
journal_sellers.filter(RQLQuery(id=seller_id))
27+
.filter(RQLQuery(name="E2E Seeded Seller"))
28+
.select(*select_fields)
29+
)
30+
31+
result = list(filtered_sellers.iterate())
32+
33+
assert len(result) == 1

0 commit comments

Comments
 (0)