Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions tests/e2e/accounts/buyers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ 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(
Expand Down
21 changes: 21 additions & 0 deletions tests/e2e/catalog/authorizations/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest


@pytest.fixture
def authorizations_service(mpt_ops):
return mpt_ops.catalog.authorizations


@pytest.fixture
def authorization_data(product_id, seller_id, account_id, short_uuid):
return {
"externalIds": {"operations": f"e2e-{short_uuid}"},
"product": {"id": product_id},
"owner": {"id": seller_id},
"journal": {"firstInvoiceDate": "2025-12-01", "frequency": "1m"},
"eligibility": {"client": True, "partner": True},
"currency": "USD",
"notes": "e2e - please delete",
"name": "e2e - please delete",
"vendor": {"id": account_id},
}
55 changes: 55 additions & 0 deletions tests/e2e/catalog/authorizations/test_async_authorizations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import pytest

from mpt_api_client.exceptions import MPTAPIError
from mpt_api_client.rql.query_builder import RQLQuery
from tests.e2e.helper import assert_async_update_resource, async_create_fixture_resource_and_delete

Comment on lines +1 to +6
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cat -n tests/e2e/catalog/authorizations/test_async_authorizations.py | head -30

Repository: softwareone-platform/mpt-api-python-client

Length of output: 1285


🏁 Script executed:

fd -t f -name "pyproject.toml" -o -name "ruff.toml" -o -name ".flake8" | head -10

Repository: softwareone-platform/mpt-api-python-client

Length of output: 316


🏁 Script executed:

rg "noqa" tests/e2e/catalog/authorizations/test_async_authorizations.py -n

Repository: softwareone-platform/mpt-api-python-client

Length of output: 177


🏁 Script executed:

cat pyproject.toml | grep -A 50 "\[tool.ruff\]" | head -80

Repository: softwareone-platform/mpt-api-python-client

Length of output: 1373


🏁 Script executed:

cat pyproject.toml | grep -i "flake8\|aaa01" -B 2 -A 2

Repository: softwareone-platform/mpt-api-python-client

Length of output: 1574


🏁 Script executed:

fd -t f "pyproject.toml" -exec grep -l "flake8-aaa\|AAA" {} \;

Repository: softwareone-platform/mpt-api-python-client

Length of output: 336


Remove unnecessary noqa: AAA01 directive on line 23.

The imports on lines 1–6 are correctly sorted (stdlib, third-party, local with proper blank line separators). However, line 23 has # noqa: AAA01 which is unnecessary. flake8-aaa is installed as a dev dependency but not enabled in the ruff configuration ([tool.ruff.lint] does not include "AAA" in the select list). Remove this noqa directive.

🤖 Prompt for AI Agents
In tests/e2e/catalog/authorizations/test_async_authorizations.py (lines 1–6),
remove the unnecessary "# noqa: AAA01" directive found on line 23; since the AAA
rule set is not enabled in the project Ruff config, delete that noqa comment,
save the file, and run the linter (ruff/flake8) to verify no remaining noqa for
AAA is required.

pytestmark = [pytest.mark.flaky]


@pytest.fixture
def async_authorizations_service(async_mpt_ops):
return async_mpt_ops.catalog.authorizations


@pytest.fixture
async def created_authorization(async_authorizations_service, authorization_data):
async with async_create_fixture_resource_and_delete(
async_authorizations_service, authorization_data
) as authorization:
yield authorization


def test_create_authorization(created_authorization, authorization_data): # noqa: AAA01
assert created_authorization.name == authorization_data["name"]
Comment on lines +23 to +24
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused noqa directive.

The noqa: AAA01 directive is not recognized by the project's linter (Ruff) and should be removed.

Apply this diff:

-def test_create_authorization(created_authorization, authorization_data):  # noqa: AAA01
+def test_create_authorization(created_authorization, authorization_data):
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_create_authorization(created_authorization, authorization_data): # noqa: AAA01
assert created_authorization.name == authorization_data["name"]
def test_create_authorization(created_authorization, authorization_data):
assert created_authorization.name == authorization_data["name"]
🧰 Tools
🪛 Ruff (0.14.7)

23-23: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

🤖 Prompt for AI Agents
In tests/e2e/catalog/authorizations/test_async_authorizations.py around lines 23
to 24, the test function contains an unused and unrecognized noqa directive `#
noqa: AAA01`; remove the `# noqa: AAA01` suffix from the function definition
line so the file no longer contains the invalid linter directive and the test
reads simply `def test_create_authorization(created_authorization,
authorization_data):` with the assertion unchanged.



async def test_get_authorization(async_authorizations_service, authorization_id):
result = await async_authorizations_service.get(authorization_id)

assert result.id == authorization_id


async def test_filter_authorizations(async_authorizations_service, authorization_id):
select_fields = ["-description"]
filtered = async_authorizations_service.filter(RQLQuery(id=authorization_id)).select(
*select_fields
)

result = [auth async for auth in filtered.iterate()]

assert len(result) == 1
assert result[0].id == authorization_id


async def test_get_authorization_not_found(async_authorizations_service):
bogus_id = "AUT-0000-0000"

with pytest.raises(MPTAPIError, match=r"404 Not Found"):
await async_authorizations_service.get(bogus_id)


async def test_update_authorization(async_authorizations_service, authorization_id, short_uuid):
await assert_async_update_resource(
async_authorizations_service, authorization_id, "notes", f"e2e test - {short_uuid}"
)
48 changes: 48 additions & 0 deletions tests/e2e/catalog/authorizations/test_authorizations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import pytest

from mpt_api_client.exceptions import MPTAPIError
from mpt_api_client.rql.query_builder import RQLQuery
from tests.e2e.helper import assert_update_resource, create_fixture_resource_and_delete

pytestmark = [pytest.mark.flaky]


@pytest.fixture
def created_authorization(authorizations_service, authorization_data):
with create_fixture_resource_and_delete(
authorizations_service, authorization_data
) as authorization:
yield authorization


def test_get_authorization(authorizations_service, authorization_id):
result = authorizations_service.get(authorization_id)

assert result.id == authorization_id


def test_create_authorization(created_authorization, authorization_data): # noqa: AAA01
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Remove unused noqa directive.

The noqa: AAA01 directive is not recognized by the linter and should be removed.

Apply this diff:

-def test_create_authorization(created_authorization, authorization_data):  # noqa: AAA01
+def test_create_authorization(created_authorization, authorization_data):
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_create_authorization(created_authorization, authorization_data): # noqa: AAA01
def test_create_authorization(created_authorization, authorization_data):
🧰 Tools
🪛 Ruff (0.14.7)

24-24: Unused noqa directive (unknown: AAA01)

Remove unused noqa directive

(RUF100)

🤖 Prompt for AI Agents
In tests/e2e/catalog/authorizations/test_authorizations.py around line 24, the
test definition includes an unused and unrecognized noqa directive "noqa:
AAA01"; remove the trailing ",  # noqa: AAA01" from the function signature so
the test line reads simply "def test_create_authorization(created_authorization,
authorization_data):" to eliminate the invalid linter directive.

assert created_authorization.name == authorization_data["name"]


def test_filter_authorizations(authorizations_service, authorization_id):
select_fields = ["-description"]
filtered = authorizations_service.filter(RQLQuery(id=authorization_id)).select(*select_fields)

result = list(filtered.iterate())

assert len(result) == 1
assert result[0].id == authorization_id


def test_get_authorization_not_found(authorizations_service):
bogus_id = "AUT-0000-0000"

with pytest.raises(MPTAPIError, match=r"404 Not Found"):
authorizations_service.get(bogus_id)


def test_update_authorization(authorizations_service, authorization_id, short_uuid):
assert_update_resource(
authorizations_service, authorization_id, "notes", f"e2e test - {short_uuid}"
) # act
9 changes: 2 additions & 7 deletions tests/e2e/catalog/pricing_policies/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@


@pytest.fixture
def buyer_id(e2e_config):
return e2e_config["accounts.buyer.account.id"]


@pytest.fixture
def pricing_policy_data(buyer_id, product_id):
def pricing_policy_data(buyer_account_id, product_id):
return {
"name": "e2e - pricing policy please delete",
"description": "Test pricing policy description",
"client": {"id": buyer_id},
"client": {"id": buyer_account_id},
"product": {"id": product_id},
"eligibility": {"client": True, "partner": False},
"margin": "0.20",
Expand Down
5 changes: 5 additions & 0 deletions tests/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ 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 licensee_id(e2e_config):
return e2e_config["accounts.licensee.id"]
Expand Down