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
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ repos:
hooks:
- id: uv-lock

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies: [Flake8-pyproject, Flake8-AAA, wemake-python-styleguide==1.3.*]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.0
hooks:
- id: mypy
args: ["--config-file=pyproject.toml", "."]
pass_filenames: false

- repo: https://github.com/pycqa/flake8
rev: 7.3.0
hooks:
- id: flake8
additional_dependencies: [wemake-python-styleguide==1.3.*]
55 changes: 49 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ dependencies = [
[dependency-groups]
dev = [
"dependency-injector>=4.48.2",
"flake8-aaa>=0.17.2",
"flake8-pyproject>=1.2.3",
"freezegun==1.5.*",
"ipdb==0.13.*",
"ipython==9.*",
Expand Down Expand Up @@ -61,7 +63,7 @@ build-backend = "hatchling.build"
[tool.pytest.ini_options]
testpaths = "tests"
pythonpath = "."
addopts = "--cov=mpt_api_client --cov-report=term-missing --cov-report=html --cov-report=xml --import-mode=importlib"
addopts = "--cov=mpt_api_client --cov-report=term-missing --cov-report=xml --import-mode=importlib"
log_cli = false
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"
Expand All @@ -81,18 +83,59 @@ exclude_also = [
"if __name__ == \"__main__\":",
"raise NotImplementedError",
]
include = [
"mpt_api_client/**",
]
omit = [
"*/__init__.py"
]

[tool.flake8]
allowed-domain-names = ["result"]
aaa_act_block_style = "large"
doctests = true
extend-ignore = ["WPS226", "WPS412"]
extend-exclude = [
".coverage",
".github",
".idea",
".mypy_cache",
".pytest_cache",
".ruff_cache",
"uv.lock",
".venv"
]
format = "wemake"
max-imports = 17
max-line-length = 100
select = ["AAA", "E999", "WPS"]
show-source = true
statistics = false
per-file-ignores = [
"mpt_api_client/mpt_client.py: WPS214 WPS235",
"mpt_api_client/http/mixins.py: WPS202 WPS204 WPS235",
"mpt_api_client/resources/*: WPS215",
"mpt_api_client/models/model.py: WPS215 WPS110",
"mpt_api_client/resources/accounts/*.py: WPS202 WPS215 WPS214 WPS235",
"mpt_api_client/resources/billing/*.py: WPS202 WPS204 WPS214 WPS215",
"mpt_api_client/resources/catalog/*.py: WPS110 WPS214 WPS215 WPS235",
"mpt_api_client/resources/catalog/mixins.py: WPS110 WPS202 WPS214 WPS215 WPS235",
"mpt_api_client/resources/catalog/products.py: WPS204 WPS214 WPS215 WPS235",
"mpt_api_client/rql/query_builder.py: WPS110 WPS115 WPS210 WPS214",
"tests/unit/http/test_async_service.py: WPS204 WPS202",
"tests/unit/http/test_service.py: WPS204 WPS202",
"tests/unit/http/test_mixins.py: WPS204 WPS202 WPS210",
"tests/unit/resources/catalog/test_products.py: WPS202 WPS210",
"tests/unit/resources/accounts/*.py: WPS204 WPS202 WPS210",
"tests/unit/resources/*/test_mixins.py: WPS118 WPS202 WPS204 WPS235",
"tests/unit/test_mpt_client.py: WPS235",
"tests/e2e/accounts/*.py: WPS430 WPS202",
"tests/e2e/catalog/*.py: WPS202 WPS421",
"tests/e2e/catalog/items/*.py: WPS110 WPS202",
"tests/*: WPS432 WPS202"
]

[tool.ruff]
# Ruff config: https://docs.astral.sh/ruff/settings
preview = true
target-version = "py312"
extend-exclude = [".vscode", ".devcontainer", "swo"]
output-format = "full"
line-length = 100

Expand Down Expand Up @@ -165,7 +208,7 @@ ignore = [
"PT011", # pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception
"TRY003", # long exception messages from `tryceratops`
]
external = [ "WPS" ]
external = [ "AAA", "WPS" ]

# Plugin configs:
flake8-import-conventions.banned-from = [ "datetime" ]
Expand Down
60 changes: 0 additions & 60 deletions setup.cfg

This file was deleted.

32 changes: 18 additions & 14 deletions tests/e2e/accounts/account/test_async_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,33 @@ async def test_get_account_by_id_not_found(async_mpt_ops):


async def test_get_account_by_id(async_mpt_ops, account_id):
account = await async_mpt_ops.accounts.accounts.get(account_id)
assert account is not None
result = await async_mpt_ops.accounts.accounts.get(account_id)

assert result is not None


async def test_list_accounts(async_mpt_ops):
limit = 10
accounts_page = await async_mpt_ops.accounts.accounts.fetch_page(limit=limit)
assert len(accounts_page) > 0

result = await async_mpt_ops.accounts.accounts.fetch_page(limit=limit)

assert len(result) > 0


def test_create_account(async_created_account):
account = async_created_account
assert account is not None
result = async_created_account

assert result is not None


async def test_update_account(async_mpt_ops, async_created_account, account_factory, account_icon):
updated_data = account_factory(name="Updated Account Name")

updated_account = await async_mpt_ops.accounts.accounts.update(
result = await async_mpt_ops.accounts.accounts.update(
async_created_account.id, updated_data, logo=account_icon
)

assert updated_account is not None
assert result is not None


async def test_update_account_invalid_data(
Expand Down Expand Up @@ -76,9 +80,9 @@ async def test_update_account_not_found(
async def test_account_enable(async_mpt_ops, account_factory, async_created_account):
await async_mpt_ops.accounts.accounts.disable(async_created_account.id)

account = await async_mpt_ops.accounts.accounts.enable(async_created_account.id)
result = await async_mpt_ops.accounts.accounts.enable(async_created_account.id)

assert account is not None
assert result is not None


async def test_account_enable_not_found(async_mpt_ops, invalid_account_id):
Expand All @@ -87,9 +91,9 @@ async def test_account_enable_not_found(async_mpt_ops, invalid_account_id):


async def test_account_disable(async_mpt_ops, async_created_account):
account = await async_mpt_ops.accounts.accounts.disable(async_created_account.id)
result = await async_mpt_ops.accounts.accounts.disable(async_created_account.id)

assert account is not None
assert result is not None


async def test_account_disable_not_found(async_mpt_ops, invalid_account_id):
Expand All @@ -105,6 +109,6 @@ async def test_account_rql_filter(async_mpt_ops, account_id):
.select(*selected_fields)
)

accounts = [account async for account in filtered_accounts.iterate()]
result = [account async for account in filtered_accounts.iterate()]

assert len(accounts) > 0
assert len(result) > 0
34 changes: 18 additions & 16 deletions tests/e2e/accounts/account/test_sync_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,31 @@ def test_get_account_by_id_not_found(mpt_ops):


def test_get_account_by_id(mpt_ops, account_id):
account = mpt_ops.accounts.accounts.get(account_id)
assert account is not None
result = mpt_ops.accounts.accounts.get(account_id)

assert result is not None


def test_list_accounts(mpt_ops):
limit = 10
accounts_page = mpt_ops.accounts.accounts.fetch_page(limit=limit)
assert len(accounts_page) > 0

result = mpt_ops.accounts.accounts.fetch_page(limit=limit)

assert len(result) > 0


def test_create_account(created_account):
account = created_account
assert account is not None
result = created_account

assert result is not None


def test_update_account(mpt_ops, created_account, account_factory, account_icon):
updated_data = account_factory(name="Updated Account Name")

updated_account = mpt_ops.accounts.accounts.update(
created_account.id, updated_data, logo=account_icon
)
result = mpt_ops.accounts.accounts.update(created_account.id, updated_data, logo=account_icon)

assert updated_account is not None
assert result is not None


def test_update_account_invalid_data(mpt_ops, account_factory, created_account, account_icon):
Expand All @@ -70,9 +72,9 @@ def test_update_account_not_found(mpt_ops, account_factory, invalid_account_id,
def test_account_enable(mpt_ops, account_factory, created_account):
mpt_ops.accounts.accounts.disable(created_account.id)

account = mpt_ops.accounts.accounts.enable(created_account.id)
result = mpt_ops.accounts.accounts.enable(created_account.id)

assert account is not None
assert result is not None


def test_account_enable_not_found(mpt_ops, invalid_account_id):
Expand All @@ -81,9 +83,9 @@ def test_account_enable_not_found(mpt_ops, invalid_account_id):


def test_account_disable(mpt_ops, created_account):
account = mpt_ops.accounts.accounts.disable(created_account.id)
result = mpt_ops.accounts.accounts.disable(created_account.id)

assert account is not None
assert result is not None


def test_account_disable_not_found(mpt_ops, invalid_account_id):
Expand All @@ -99,6 +101,6 @@ def test_account_rql_filter(mpt_ops, account_id):
.select(*selected_fields)
)

accounts = list(filtered_accounts.iterate())
result = list(filtered_accounts.iterate())

assert len(accounts) > 0
assert len(result) > 0
Loading