From 85080e7bea624af2cc84ae3f45722881af2896de Mon Sep 17 00:00:00 2001 From: Robert Segal Date: Thu, 20 Nov 2025 14:25:35 -0700 Subject: [PATCH] Reorganized fixtures in e2e accounts --- .github/workflows/cron-main-e2e.yml | 2 +- .github/workflows/pr-build-merge.yml | 2 +- .github/workflows/release.yml | 2 +- tests/e2e/accounts/account/conftest.py | 27 +++++ tests/e2e/accounts/api_tokens/conftest.py | 28 +++++ tests/e2e/accounts/buyers/conftest.py | 39 +++++++ tests/e2e/accounts/conftest.py | 124 +++------------------ tests/e2e/accounts/licensees/conftest.py | 52 +++++++++ tests/e2e/accounts/modules/conftest.py | 11 ++ tests/e2e/accounts/sellers/conftest.py | 29 +++++ tests/e2e/accounts/user_groups/conftest.py | 6 + tests/e2e/conftest.py | 90 --------------- 12 files changed, 210 insertions(+), 202 deletions(-) create mode 100644 tests/e2e/accounts/account/conftest.py create mode 100644 tests/e2e/accounts/api_tokens/conftest.py create mode 100644 tests/e2e/accounts/buyers/conftest.py create mode 100644 tests/e2e/accounts/licensees/conftest.py create mode 100644 tests/e2e/accounts/modules/conftest.py create mode 100644 tests/e2e/accounts/sellers/conftest.py create mode 100644 tests/e2e/accounts/user_groups/conftest.py diff --git a/.github/workflows/cron-main-e2e.yml b/.github/workflows/cron-main-e2e.yml index 3f71d330..a132189d 100644 --- a/.github/workflows/cron-main-e2e.yml +++ b/.github/workflows/cron-main-e2e.yml @@ -6,7 +6,7 @@ on: jobs: build: runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 steps: - name: "Checkout" uses: actions/checkout@v4 diff --git a/.github/workflows/pr-build-merge.yml b/.github/workflows/pr-build-merge.yml index ed2ec275..22ea8b9c 100644 --- a/.github/workflows/pr-build-merge.yml +++ b/.github/workflows/pr-build-merge.yml @@ -15,7 +15,7 @@ jobs: build: runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 steps: - name: "Checkout" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1e181fe5..094426cd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: build: runs-on: ubuntu-latest - timeout-minutes: 15 + timeout-minutes: 20 steps: - name: "Checkout" diff --git a/tests/e2e/accounts/account/conftest.py b/tests/e2e/accounts/account/conftest.py new file mode 100644 index 00000000..08435ec2 --- /dev/null +++ b/tests/e2e/accounts/account/conftest.py @@ -0,0 +1,27 @@ +import pytest + + +@pytest.fixture +def invalid_account_id(): + return "ACC-0000-0000" + + +@pytest.fixture +def account_factory(): + def _account( + name: str = "E2E Test Api Client Vendor", + ): + return { + "name": name, + "address": { + "addressLine1": "123 Test St", + "city": "San Francisco", + "state": "CA", + "postCode": "12345", + "country": "US", + }, + "type": "Vendor", + "status": "Active", + } + + return _account diff --git a/tests/e2e/accounts/api_tokens/conftest.py b/tests/e2e/accounts/api_tokens/conftest.py new file mode 100644 index 00000000..66b935cd --- /dev/null +++ b/tests/e2e/accounts/api_tokens/conftest.py @@ -0,0 +1,28 @@ +import pytest + + +@pytest.fixture +def api_token_id(e2e_config): + return e2e_config["accounts.api_token.id"] + + +@pytest.fixture +def invalid_api_token_id(): + return "TKN-0000-0000" + + +@pytest.fixture +def api_token_factory(account_id, module_id): + def _api_token( + name: str = "E2E Test API Token", + description: str = "E2E API Token created during E2E tests", + ): + return { + "account": {"id": account_id}, + "name": name, + "description": description, + "icon": "", + "modules": [{"id": module_id}], + } + + return _api_token diff --git a/tests/e2e/accounts/buyers/conftest.py b/tests/e2e/accounts/buyers/conftest.py new file mode 100644 index 00000000..f6d1dd4a --- /dev/null +++ b/tests/e2e/accounts/buyers/conftest.py @@ -0,0 +1,39 @@ +import pytest + + +@pytest.fixture +def invalid_buyer_id(): + return "BUY-0000-0000" + + +@pytest.fixture +def buyer_account_id(e2e_config): + return e2e_config["accounts.buyer.account.id"] + + +@pytest.fixture +def buyer_factory(buyer_account_id): + def _buyer( + name="E2E Created Buyer", + account_id: str = buyer_account_id, + ): + return { + "name": name, + "account": { + "id": account_id, + }, + "contact": { + "firstName": "first", + "lastName": "last", + "email": "created.buyer@example.com", + }, + "address": { + "addressLine1": "123 Main St", + "city": "Anytown", + "state": "CA", + "postCode": "12345", + "country": "US", + }, + } + + return _buyer diff --git a/tests/e2e/accounts/conftest.py b/tests/e2e/accounts/conftest.py index 7292bebf..a7a1fa7e 100644 --- a/tests/e2e/accounts/conftest.py +++ b/tests/e2e/accounts/conftest.py @@ -19,79 +19,33 @@ def currencies(): @pytest.fixture -def seller_factory(currencies): - def _seller( - external_id: str, # Must be unique in Marketplace - name="E2E Test Seller", - currencies=currencies, - ): - return { - "name": name, - "address": { - "addressLine1": "123 Main St", - "city": "Anytown", - "state": "CA", - "postCode": "12345", - "country": "US", - }, - "currencies": currencies, - "externalId": external_id, - } - - return _seller +def account_id(e2e_config): + return e2e_config["accounts.account.id"] @pytest.fixture -def account_factory(): - def _account( - name: str = "E2E Test Api Client Vendor", - ): - return { - "name": name, - "address": { - "addressLine1": "123 Test St", - "city": "San Francisco", - "state": "CA", - "postCode": "12345", - "country": "US", - }, - "type": "Vendor", - "status": "Active", - } +def seller_id(e2e_config): + return e2e_config["accounts.seller.id"] - return _account + +@pytest.fixture +def buyer_id(e2e_config): + return e2e_config["accounts.buyer.id"] @pytest.fixture -def buyer_factory(buyer_account_id): - def _buyer( - name="E2E Created Buyer", - account_id: str = buyer_account_id, - ): - return { - "name": name, - "account": { - "id": account_id, - }, - "contact": { - "firstName": "first", - "lastName": "last", - "email": "created.buyer@example.com", - }, - "address": { - "addressLine1": "123 Main St", - "city": "Anytown", - "state": "CA", - "postCode": "12345", - "country": "US", - }, - } +def user_group_id(e2e_config): + return e2e_config["accounts.user_group.id"] + - return _buyer +@pytest.fixture +def module_id(e2e_config): + return e2e_config["accounts.module.id"] @pytest.fixture def user_group_factory(account_id, module_id): + # Used in user group and licensee fixtures def _user_group( name: str = "E2E Test Api Client User Group", user_group_account_id: str = account_id, @@ -106,51 +60,3 @@ def _user_group( } return _user_group - - -@pytest.fixture -def api_token_factory(account_id, module_id): - def _api_token( - name: str = "E2E Test API Token", - description: str = "E2E API Token created during E2E tests", - ): - return { - "account": {"id": account_id}, - "name": name, - "description": description, - "icon": "", - "modules": [{"id": module_id}], - } - - return _api_token - - -@pytest.fixture -def licensee_factory(seller_id, buyer_id, user_group_factory, licensee_account_id): - def _licensee( - name: str = "Test E2E Licensee", - licensee_type: str = "Client", - ): - group = user_group_factory(user_group_account_id=licensee_account_id) - - return { - "name": name, - "address": { - "addressLine1": "456 Licensee St", - "city": "Los Angeles", - "state": "CA", - "postCode": "67890", - "country": "US", - }, - "useBuyerAddress": False, - "seller": {"id": seller_id}, - "buyer": {"id": buyer_id}, - "account": {"id": licensee_account_id}, - "eligibility": {"client": True, "partner": False}, - "groups": [group], - "type": licensee_type, - "status": "Enabled", - "defaultLanguage": "en-US", - } - - return _licensee diff --git a/tests/e2e/accounts/licensees/conftest.py b/tests/e2e/accounts/licensees/conftest.py new file mode 100644 index 00000000..8aa4bebf --- /dev/null +++ b/tests/e2e/accounts/licensees/conftest.py @@ -0,0 +1,52 @@ +import pytest + + +@pytest.fixture +def licensee_account_id(e2e_config): + return e2e_config["accounts.licensee.account.id"] + + +@pytest.fixture +def licensee_group_id(e2e_config): + return e2e_config["accounts.licensee.group.id"] + + +@pytest.fixture +def licensee_id(e2e_config): + return e2e_config["accounts.licensee.id"] + + +@pytest.fixture +def invalid_licensee_id(): + return "LCE-0000-0000-0000" + + +@pytest.fixture +def licensee_factory(seller_id, buyer_id, user_group_factory, licensee_account_id): + def _licensee( + name: str = "Test E2E Licensee", + licensee_type: str = "Client", + ): + group = user_group_factory(user_group_account_id=licensee_account_id) + + return { + "name": name, + "address": { + "addressLine1": "456 Licensee St", + "city": "Los Angeles", + "state": "CA", + "postCode": "67890", + "country": "US", + }, + "useBuyerAddress": False, + "seller": {"id": seller_id}, + "buyer": {"id": buyer_id}, + "account": {"id": licensee_account_id}, + "eligibility": {"client": True, "partner": False}, + "groups": [group], + "type": licensee_type, + "status": "Enabled", + "defaultLanguage": "en-US", + } + + return _licensee diff --git a/tests/e2e/accounts/modules/conftest.py b/tests/e2e/accounts/modules/conftest.py new file mode 100644 index 00000000..1a6f7ca0 --- /dev/null +++ b/tests/e2e/accounts/modules/conftest.py @@ -0,0 +1,11 @@ +import pytest + + +@pytest.fixture +def invalid_module_id(): + return "MOD-0000" + + +@pytest.fixture +def module_name(e2e_config): + return e2e_config["accounts.module.name"] diff --git a/tests/e2e/accounts/sellers/conftest.py b/tests/e2e/accounts/sellers/conftest.py new file mode 100644 index 00000000..2b903b50 --- /dev/null +++ b/tests/e2e/accounts/sellers/conftest.py @@ -0,0 +1,29 @@ +import pytest + + +@pytest.fixture +def invalid_seller_id(): + return "SEL-0000-0000" + + +@pytest.fixture +def seller_factory(currencies): + def _seller( + external_id: str, # Must be unique in Marketplace + name="E2E Test Seller", + currencies=currencies, + ): + return { + "name": name, + "address": { + "addressLine1": "123 Main St", + "city": "Anytown", + "state": "CA", + "postCode": "12345", + "country": "US", + }, + "currencies": currencies, + "externalId": external_id, + } + + return _seller diff --git a/tests/e2e/accounts/user_groups/conftest.py b/tests/e2e/accounts/user_groups/conftest.py new file mode 100644 index 00000000..e9587720 --- /dev/null +++ b/tests/e2e/accounts/user_groups/conftest.py @@ -0,0 +1,6 @@ +import pytest + + +@pytest.fixture +def invalid_user_group_id(): + return "UGR-0000-0000" diff --git a/tests/e2e/conftest.py b/tests/e2e/conftest.py index a9b78c45..c2f83c79 100644 --- a/tests/e2e/conftest.py +++ b/tests/e2e/conftest.py @@ -97,102 +97,12 @@ def product_id(e2e_config): return e2e_config["catalog.product.id"] -@pytest.fixture -def invalid_seller_id(): - return "SEL-0000-0000" - - -@pytest.fixture -def seller_id(e2e_config): - return e2e_config["accounts.seller.id"] - - -@pytest.fixture -def account_id(e2e_config): - return e2e_config["accounts.account.id"] - - -@pytest.fixture -def invalid_account_id(): - return "ACC-0000-0000" - - @pytest.fixture def short_uuid(): return uuid.uuid4().hex[:8] -@pytest.fixture -def invalid_buyer_id(): - return "BUY-0000-0000" - - -@pytest.fixture -def buyer_id(e2e_config): - return e2e_config["accounts.buyer.id"] - - -@pytest.fixture -def buyer_account_id(e2e_config): - return e2e_config["accounts.buyer.account.id"] - - -@pytest.fixture -def user_group_id(e2e_config): - return e2e_config["accounts.user_group.id"] - - -@pytest.fixture -def invalid_user_group_id(): - return "UGR-0000-0000" - - -@pytest.fixture -def module_id(e2e_config): - return e2e_config["accounts.module.id"] - - -@pytest.fixture -def invalid_module_id(): - return "MOD-0000" - - -@pytest.fixture -def module_name(e2e_config): - return e2e_config["accounts.module.name"] - - -@pytest.fixture -def api_token_id(e2e_config): - return e2e_config["accounts.api_token.id"] - - -@pytest.fixture -def invalid_api_token_id(): - return "TKN-0000-0000" - - @pytest.fixture def logo_fd(): file_path = pathlib.Path(__file__).parent / "logo.png" return pathlib.Path.open(file_path, "rb") - - -@pytest.fixture -def licensee_id(e2e_config): - return e2e_config["accounts.licensee.id"] - - -@pytest.fixture -def invalid_licensee_id(): - return "LCE-0000-0000-0000" - - -@pytest.fixture -def licensee_account_id(e2e_config): - return e2e_config["accounts.licensee.account.id"] - - -@pytest.fixture -def licensee_group_id(e2e_config): - return e2e_config["accounts.licensee.group.id"]