Skip to content

Commit 82dc28b

Browse files
authored
Merge pull request #269
MPT-19488 merge chat message fixtures and unskip link tests
2 parents 78ed68a + 7e9f6f6 commit 82dc28b

File tree

6 files changed

+151
-146
lines changed

6 files changed

+151
-146
lines changed

pyproject.toml

Lines changed: 83 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,51 @@ description = "SoftwareOne Marketplace API Client for Python"
55
authors = [{ name = "SoftwareOne AG" }]
66
requires-python = ">=3.12,<4"
77
readme = "docs/PROJECT_DESCRIPTION.md"
8-
license = {text = "Apache-2.0 license"}
8+
license = { text = "Apache-2.0 license" }
99
keywords = [
10-
"openapi",
11-
"client",
12-
"softwareone",
13-
"marketplace",
10+
"openapi",
11+
"client",
12+
"softwareone",
13+
"marketplace",
1414
]
1515
classifiers = [
16-
"Development Status :: 5 - Production/Stable",
17-
"Environment :: Console",
18-
"Operating System :: POSIX :: Linux",
19-
"Programming Language :: Python :: 3.12",
20-
"Topic :: Utilities",
16+
"Development Status :: 5 - Production/Stable",
17+
"Environment :: Console",
18+
"Operating System :: POSIX :: Linux",
19+
"Programming Language :: Python :: 3.12",
20+
"Topic :: Utilities",
2121
]
2222
dependencies = [
23-
"httpx==0.28.*",
23+
"httpx==0.28.*",
2424
]
2525

2626
[dependency-groups]
2727
dev = [
28-
"dependency-injector==4.49.*",
29-
"flake8==7.3.*", # force flake8 version to have same formatting everywhere, also update in pre-commit config
30-
"flake8-aaa==0.17.*", # also update pre-commit config
31-
"flake8-pyproject==1.2.*", # also update pre-commit config
32-
"freezegun==1.5.*",
33-
"ipdb==0.13.*",
34-
"ipython==9.*",
35-
"mypy==1.19.*",
36-
"pre-commit==4.5.*",
37-
"pyfakefs==6.1.*",
38-
"pytest==9.0.*",
39-
"pytest-asyncio==1.3.*",
40-
"pytest-cov==7.1.*",
41-
"pytest-deadfixtures==3.1.*",
42-
"pytest-mock==3.15.*",
43-
"pytest-randomly==4.0.*",
44-
"pytest-reportportal==5.6.*",
45-
"pytest-rerunfailures==16.1.*",
46-
"pytest-xdist==3.8.*",
47-
"responses==0.26.*",
48-
"respx==0.22.*",
49-
"ruff==0.15.*", # force ruff version to have same formatting everywhere
50-
"typing-extensions==4.15.*",
51-
"wemake-python-styleguide==1.6.*",
52-
"types-python-dateutil==2.9.*",
28+
"dependency-injector==4.49.*",
29+
"flake8==7.3.*", # force flake8 version to have same formatting everywhere, also update in pre-commit config
30+
"flake8-aaa==0.17.*", # also update pre-commit config
31+
"flake8-pyproject==1.2.*", # also update pre-commit config
32+
"freezegun==1.5.*",
33+
"ipdb==0.13.*",
34+
"ipython==9.*",
35+
"mypy==1.19.*",
36+
"pre-commit==4.5.*",
37+
"pyfakefs==6.1.*",
38+
"pytest==9.0.*",
39+
"pytest-asyncio==1.3.*",
40+
"pytest-cov==7.1.*",
41+
"pytest-deadfixtures==3.1.*",
42+
"pytest-mock==3.15.*",
43+
"pytest-randomly==4.0.*",
44+
"pytest-reportportal==5.6.*",
45+
"pytest-rerunfailures==16.1.*",
46+
"pytest-xdist==3.8.*",
47+
"responses==0.26.*",
48+
"respx==0.22.*",
49+
"ruff==0.15.*", # force ruff version to have same formatting everywhere
50+
"typing-extensions==4.15.*",
51+
"wemake-python-styleguide==1.6.*",
52+
"types-python-dateutil==2.9.*",
5353
]
5454

5555
[tool.hatch.build.targets.sdist]
@@ -70,8 +70,8 @@ log_cli = false
7070
asyncio_mode = "auto"
7171
asyncio_default_fixture_loop_scope = "function"
7272
filterwarnings = [
73-
"ignore:Support for class-based `config` is deprecated:DeprecationWarning",
74-
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
73+
"ignore:Support for class-based `config` is deprecated:DeprecationWarning",
74+
"ignore:pkg_resources is deprecated as an API:DeprecationWarning",
7575
]
7676
rp_project = "mpt-api-python-client"
7777
markers = [
@@ -85,11 +85,11 @@ source = ["mpt_api_client"]
8585

8686
[tool.coverage.report]
8787
exclude_also = [
88-
"if __name__ == \"__main__\":",
89-
"raise NotImplementedError",
88+
"if __name__ == \"__main__\":",
89+
"raise NotImplementedError",
9090
]
9191
omit = [
92-
"*/__init__.py"
92+
"*/__init__.py"
9393
]
9494

9595
[tool.flake8]
@@ -134,6 +134,7 @@ per-file-ignores = [
134134
"tests/e2e/commerce/order/*.py: WPS202 WPS204",
135135
"tests/e2e/commerce/order/asset/*.py: WPS211 WPS202",
136136
"tests/e2e/commerce/subscription/*.py: WPS202",
137+
"tests/e2e/helpdesk/chats/links/*.py: WPS221 WPS202",
137138
"tests/unit/http/test_async_service.py: WPS204 WPS202",
138139
"tests/unit/http/test_resource_accessor.py: WPS204 WPS202 WPS210 WPS219",
139140
"tests/unit/http/test_service.py: WPS204 WPS202",
@@ -159,48 +160,48 @@ docstring-code-format = false
159160

160161
[tool.ruff.lint]
161162
select = [
162-
"A", # flake8-builtins
163-
"B", # flake8-bugbear
164-
"C4", # flake8-comprehensions
165-
"C90", # maccabe
166-
"COM", # flake8-commas
167-
"D", # pydocstyle
168-
"DTZ", # flake8-datetimez
169-
"E", # pycodestyle
170-
"ERA", # flake8-eradicate
171-
"EXE", # flake8-executable
172-
"F", # pyflakes
173-
"FBT", # flake8-boolean-trap
174-
"FLY", # pyflint
163+
"A", # flake8-builtins
164+
"B", # flake8-bugbear
165+
"C4", # flake8-comprehensions
166+
"C90", # maccabe
167+
"COM", # flake8-commas
168+
"D", # pydocstyle
169+
"DTZ", # flake8-datetimez
170+
"E", # pycodestyle
171+
"ERA", # flake8-eradicate
172+
"EXE", # flake8-executable
173+
"F", # pyflakes
174+
"FBT", # flake8-boolean-trap
175+
"FLY", # pyflint
175176
"FURB", # refurb
176-
"G", # flake8-logging-format
177-
"I", # isort
178-
"ICN", # flake8-import-conventions
179-
"ISC", # flake8-implicit-str-concat
180-
"LOG", # flake8-logging
181-
"N", # pep8-naming
177+
"G", # flake8-logging-format
178+
"I", # isort
179+
"ICN", # flake8-import-conventions
180+
"ISC", # flake8-implicit-str-concat
181+
"LOG", # flake8-logging
182+
"N", # pep8-naming
182183
"PERF", # perflint
183-
"PIE", # flake8-pie
184-
"PL", # pylint
185-
"PT", # flake8-pytest-style
186-
"PTH", # flake8-use-pathlib
187-
"Q", # flake8-quotes
188-
"RET", # flake8-return
189-
"RSE", # flake8-raise
190-
"RUF", # ruff
191-
"S", # flake8-bandit
192-
"SIM", # flake8-simpify
193-
"SLF", # flake8-self
184+
"PIE", # flake8-pie
185+
"PL", # pylint
186+
"PT", # flake8-pytest-style
187+
"PTH", # flake8-use-pathlib
188+
"Q", # flake8-quotes
189+
"RET", # flake8-return
190+
"RSE", # flake8-raise
191+
"RUF", # ruff
192+
"S", # flake8-bandit
193+
"SIM", # flake8-simpify
194+
"SLF", # flake8-self
194195
"SLOT", # flake8-slots
195196
"T100", # flake8-debugger
196-
"TRY", # tryceratops
197-
"UP", # pyupgrade
198-
"W", # pycodestyle
199-
"YTT", # flake8-2020
197+
"TRY", # tryceratops
198+
"UP", # pyupgrade
199+
"W", # pycodestyle
200+
"YTT", # flake8-2020
200201
]
201202
ignore = [
202-
"A005", # allow to shadow stdlib and builtin module names
203-
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
203+
"A005", # allow to shadow stdlib and builtin module names
204+
"B904", # Within an `except` clause, raise exceptions with `raise ... from err` or `raise ... from None` to distinguish them from errors in exception handling
204205
"COM812", # trailing comma, conflicts with `ruff format`
205206
# Different doc rules that we don't really care about:
206207
"D100",
@@ -213,15 +214,15 @@ ignore = [
213214
"D401",
214215
"D404",
215216
"D405",
216-
"ISC001", # implicit string concat conflicts with `ruff format`
217-
"ISC003", # prefer explicit string concat over implicit concat
218-
"PLR09", # we have our own complexity rules
217+
"ISC001", # implicit string concat conflicts with `ruff format`
218+
"ISC003", # prefer explicit string concat over implicit concat
219+
"PLR09", # we have our own complexity rules
219220
"PLR2004", # do not report magic numbers
220221
"PLR6301", # do not require classmethod / staticmethod when self not used
221222
"PT011", # pytest.raises({exception}) is too broad, set the match parameter or use a more specific exception
222-
"TRY003", # long exception messages from `tryceratops`
223+
"TRY003", # long exception messages from `tryceratops`
223224
]
224-
external = [ "AAA", "WPS" ]
225+
external = ["AAA", "WPS"]
225226

226227
# Plugin configs:
227228
[tool.ruff.lint.flake8-import-conventions]

tests/e2e/helpdesk/chats/conftest.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import pytest
22

3+
from tests.e2e.helper import (
4+
async_create_fixture_resource_and_delete,
5+
create_fixture_resource_and_delete,
6+
)
7+
38

49
@pytest.fixture(scope="session")
510
def chat_id(e2e_config):
@@ -9,3 +14,41 @@ def chat_id(e2e_config):
914
@pytest.fixture(scope="session")
1015
def invalid_chat_id():
1116
return "CHT-0000-0000-0000"
17+
18+
19+
@pytest.fixture
20+
def chat_messages_service(mpt_ops, created_chat):
21+
return mpt_ops.helpdesk.chats.messages(created_chat.id)
22+
23+
24+
@pytest.fixture
25+
def async_chat_messages_service(async_mpt_ops, created_chat):
26+
return async_mpt_ops.helpdesk.chats.messages(created_chat.id)
27+
28+
29+
@pytest.fixture
30+
def chat_message_data(short_uuid):
31+
return {
32+
"content": f"e2e message - {short_uuid}",
33+
}
34+
35+
36+
@pytest.fixture
37+
def created_chat_message(chat_messages_service, chat_message_data):
38+
with create_fixture_resource_and_delete(
39+
chat_messages_service, chat_message_data
40+
) as chat_message:
41+
yield chat_message
42+
43+
44+
@pytest.fixture
45+
async def async_created_chat_message(async_chat_messages_service, chat_message_data):
46+
async with async_create_fixture_resource_and_delete(
47+
async_chat_messages_service, chat_message_data
48+
) as chat_message:
49+
yield chat_message
50+
51+
52+
@pytest.fixture(scope="session")
53+
def invalid_chat_message_id():
54+
return "MSG-0000-0000-0000"

tests/e2e/helpdesk/chats/links/conftest.py

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,36 @@
77

88

99
@pytest.fixture
10-
def chat_links_service(mpt_ops, chat_id):
11-
return mpt_ops.helpdesk.chats.links(chat_id)
10+
def chat_links_service(mpt_ops, created_chat):
11+
return mpt_ops.helpdesk.chats.links(created_chat.id)
1212

1313

1414
@pytest.fixture
15-
def async_chat_links_service(async_mpt_ops, chat_id):
16-
return async_mpt_ops.helpdesk.chats.links(chat_id)
15+
def async_chat_links_service(async_mpt_ops, created_chat):
16+
return async_mpt_ops.helpdesk.chats.links(created_chat.id)
1717

1818

1919
@pytest.fixture
20-
def chat_link_data(short_uuid):
20+
def chat_link_data(created_chat_message, short_uuid):
2121
return {
2222
"uri": f"https://example.com/e2e-link-{short_uuid}",
2323
"name": f"e2e link - {short_uuid}",
24+
"message": created_chat_message.to_dict(),
2425
}
2526

2627

2728
@pytest.fixture
28-
def created_chat_link(chat_links_service, chat_link_data):
29+
def created_chat_link(mpt_ops, chat_links_service, chat_link_data):
2930
with create_fixture_resource_and_delete(chat_links_service, chat_link_data) as chat_link:
3031
yield chat_link
3132

3233

34+
@pytest.fixture
35+
def created_chat_link_service(chat_links_service, chat_link_data):
36+
with create_fixture_resource_and_delete(chat_links_service, chat_link_data):
37+
yield chat_links_service
38+
39+
3340
@pytest.fixture
3441
async def async_created_chat_link(async_chat_links_service, chat_link_data):
3542
async with async_create_fixture_resource_and_delete(
@@ -38,6 +45,12 @@ async def async_created_chat_link(async_chat_links_service, chat_link_data):
3845
yield chat_link
3946

4047

48+
@pytest.fixture
49+
async def async_created_chat_link_service(async_chat_links_service, chat_link_data):
50+
async with async_create_fixture_resource_and_delete(async_chat_links_service, chat_link_data):
51+
yield async_chat_links_service
52+
53+
4154
@pytest.fixture(scope="session")
4255
def invalid_chat_link_id():
4356
return "LNK-0000-0000-0000"

tests/e2e/helpdesk/chats/links/test_async_links.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,18 @@
88
pytestmark = [pytest.mark.flaky]
99

1010

11-
@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
12-
async def test_list_chat_links(async_chat_links_service):
13-
result = await async_chat_links_service.fetch_page(limit=1)
11+
async def test_list_chat_links(async_created_chat_link_service):
12+
result = await async_created_chat_link_service.fetch_page(limit=1)
1413

1514
assert len(result) > 0
1615
assert all(isinstance(link, ChatLink) for link in result)
1716

1817

19-
@pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01
20-
def test_create_chat_link(async_created_chat_link, chat_link_data):
18+
def test_create_chat_link(async_created_chat_link, chat_link_data): # noqa: AAA01
2119
assert async_created_chat_link.id is not None
2220
assert async_created_chat_link.to_dict().get("uri") == chat_link_data["uri"]
2321

2422

25-
@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
2623
async def test_update_chat_link_name(async_chat_links_service, async_created_chat_link, short_uuid):
2724
new_name = f"e2e updated link - {short_uuid}"
2825

@@ -35,7 +32,6 @@ async def test_update_chat_link_name(async_chat_links_service, async_created_cha
3532
assert result.to_dict().get("name") == new_name
3633

3734

38-
@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
3935
async def test_delete_chat_link(async_chat_links_service, async_created_chat_link):
4036
result = async_created_chat_link
4137

0 commit comments

Comments
 (0)