diff --git a/e2e_config.test.json b/e2e_config.test.json index a24bea2..b580965 100644 --- a/e2e_config.test.json +++ b/e2e_config.test.json @@ -57,6 +57,7 @@ "commerce.product.template.id": "TPL-1767-7355-0002", "commerce.user.id": "USR-4303-2348", "helpdesk.chat.id": "CHT-5064-0262-3671", + "helpdesk.channel.id": "CHL-5064-0262-3671", "commerce.subscription.agreement.id": "AGR-2473-3299-1721", "commerce.subscription.id": "SUB-3678-1831-2188", "commerce.subscription.product.item.id": "ITM-1767-7355-0001", diff --git a/tests/e2e/helpdesk/cases/test_async_cases.py b/tests/e2e/helpdesk/cases/test_async_cases.py index cd060d3..4e44f3d 100644 --- a/tests/e2e/helpdesk/cases/test_async_cases.py +++ b/tests/e2e/helpdesk/cases/test_async_cases.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.cases import Case pytestmark = [pytest.mark.flaky] @@ -12,13 +15,13 @@ async def test_get_case(async_mpt_ops, async_created_case): assert result.id == async_created_case.id -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_list_cases(async_mpt_ops): limit = 1 result = await async_mpt_ops.helpdesk.cases.fetch_page(limit=limit) assert len(result) > 0 + assert all(isinstance(case, Case) for case in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") @@ -65,7 +68,7 @@ async def test_complete_case(async_mpt_ops, async_created_case): assert result is not None -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_not_found(async_mpt_ops, invalid_case_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_mpt_ops.helpdesk.cases.get(invalid_case_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/cases/test_sync_cases.py b/tests/e2e/helpdesk/cases/test_sync_cases.py index dfd10d5..3679a6c 100644 --- a/tests/e2e/helpdesk/cases/test_sync_cases.py +++ b/tests/e2e/helpdesk/cases/test_sync_cases.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.cases import Case pytestmark = [pytest.mark.flaky] @@ -12,13 +15,13 @@ def test_get_case(mpt_ops, created_case): assert result.id == created_case.id -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_list_cases(mpt_ops): limit = 1 result = mpt_ops.helpdesk.cases.fetch_page(limit=limit) assert len(result) > 0 + assert all(isinstance(case, Case) for case in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") @@ -65,7 +68,8 @@ def test_complete_case(mpt_ops, created_case): assert result is not None -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_not_found(mpt_ops, invalid_case_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: mpt_ops.helpdesk.cases.get(invalid_case_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/channels/conftest.py b/tests/e2e/helpdesk/channels/conftest.py index e4b5a0f..19bf223 100644 --- a/tests/e2e/helpdesk/channels/conftest.py +++ b/tests/e2e/helpdesk/channels/conftest.py @@ -8,7 +8,7 @@ @pytest.fixture def channel_id(e2e_config): - return e2e_config["helpdesk.channel.id"] + return e2e_config["helpdesk.channel.id"] # FIXME: seed data @pytest.fixture diff --git a/tests/e2e/helpdesk/channels/messages/__init__.py b/tests/e2e/helpdesk/channels/messages/__init__.py index 8b13789..e69de29 100644 --- a/tests/e2e/helpdesk/channels/messages/__init__.py +++ b/tests/e2e/helpdesk/channels/messages/__init__.py @@ -1 +0,0 @@ - diff --git a/tests/e2e/helpdesk/channels/messages/test_async_messages.py b/tests/e2e/helpdesk/channels/messages/test_async_messages.py index 2429147..79492f1 100644 --- a/tests/e2e/helpdesk/channels/messages/test_async_messages.py +++ b/tests/e2e/helpdesk/channels/messages/test_async_messages.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_messages import ChatMessage pytestmark = [pytest.mark.flaky] @@ -10,9 +13,11 @@ async def test_list_channel_messages(async_channel_messages_service): result = await async_channel_messages_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(message, ChatMessage) for message in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_list_channel_messages_not_found(async_mpt_ops, invalid_channel_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_mpt_ops.helpdesk.channels.messages(invalid_channel_id).fetch_page(limit=1) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/channels/messages/test_sync_messages.py b/tests/e2e/helpdesk/channels/messages/test_sync_messages.py index a10c9c0..4e3121a 100644 --- a/tests/e2e/helpdesk/channels/messages/test_sync_messages.py +++ b/tests/e2e/helpdesk/channels/messages/test_sync_messages.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_messages import ChatMessage pytestmark = [pytest.mark.flaky] @@ -10,9 +13,12 @@ def test_list_channel_messages(channel_messages_service): result = channel_messages_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(message, ChatMessage) for message in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_list_channel_messages_not_found(mpt_ops, invalid_channel_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: mpt_ops.helpdesk.channels.messages(invalid_channel_id).fetch_page(limit=1) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/channels/test_async_channels.py b/tests/e2e/helpdesk/channels/test_async_channels.py index 93a6d96..8fd7232 100644 --- a/tests/e2e/helpdesk/channels/test_async_channels.py +++ b/tests/e2e/helpdesk/channels/test_async_channels.py @@ -1,11 +1,13 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.channels import Channel -pytestmark = [pytest.mark.flaky] +pytestmark = [pytest.mark.flaky, pytest.mark.skip(reason="Unskip after MPT-19124 completed")] -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_get_channel(async_mpt_ops, channel_id): service = async_mpt_ops.helpdesk.channels @@ -14,23 +16,21 @@ async def test_get_channel(async_mpt_ops, channel_id): assert result.id == channel_id -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_list_channels(async_mpt_ops): service = async_mpt_ops.helpdesk.channels result = await service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(channel, Channel) for channel in result) -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_create_channel(async_created_channel): result = async_created_channel assert result.id is not None -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_update_channel(async_mpt_ops, async_created_channel, short_uuid): service = async_mpt_ops.helpdesk.channels new_name = f"E2E Updated Channel {short_uuid}" @@ -41,7 +41,6 @@ async def test_update_channel(async_mpt_ops, async_created_channel, short_uuid): assert result.to_dict().get("name") == new_name -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_delete_channel(async_mpt_ops, async_created_channel): result = async_created_channel @@ -51,5 +50,6 @@ async def test_delete_channel(async_mpt_ops, async_created_channel): async def test_not_found(async_mpt_ops, invalid_channel_id): service = async_mpt_ops.helpdesk.channels - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await service.get(invalid_channel_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/channels/test_sync_channels.py b/tests/e2e/helpdesk/channels/test_sync_channels.py index fa21ccd..fa7da44 100644 --- a/tests/e2e/helpdesk/channels/test_sync_channels.py +++ b/tests/e2e/helpdesk/channels/test_sync_channels.py @@ -1,11 +1,13 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.channels import Channel -pytestmark = [pytest.mark.flaky] +pytestmark = [pytest.mark.flaky, pytest.mark.skip(reason="Unskip after MPT-19124 completed")] -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_get_channel(mpt_ops, channel_id): service = mpt_ops.helpdesk.channels @@ -14,23 +16,21 @@ def test_get_channel(mpt_ops, channel_id): assert result.id == channel_id -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_list_channels(mpt_ops): service = mpt_ops.helpdesk.channels result = service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(channel, Channel) for channel in result) -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_create_channel(created_channel): result = created_channel assert result.id is not None -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_update_channel(mpt_ops, created_channel, short_uuid): service = mpt_ops.helpdesk.channels new_name = f"E2E Updated Channel {short_uuid}" @@ -41,7 +41,6 @@ def test_update_channel(mpt_ops, created_channel, short_uuid): assert result.to_dict().get("name") == new_name -@pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_delete_channel(mpt_ops, created_channel): result = created_channel @@ -51,5 +50,7 @@ def test_delete_channel(mpt_ops, created_channel): def test_not_found(mpt_ops, invalid_channel_id): service = mpt_ops.helpdesk.channels - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: service.get(invalid_channel_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/answers/parameters/test_async_parameters.py b/tests/e2e/helpdesk/chats/answers/parameters/test_async_parameters.py index 8afb281..5aee084 100644 --- a/tests/e2e/helpdesk/chats/answers/parameters/test_async_parameters.py +++ b/tests/e2e/helpdesk/chats/answers/parameters/test_async_parameters.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_answer_parameters import ChatAnswerParameter pytestmark = [ pytest.mark.flaky, @@ -11,7 +14,8 @@ async def test_list_chat_answer_parameters(async_chat_answer_parameters_service): result = await async_chat_answer_parameters_service.fetch_page(limit=20) - assert len(result) >= 0 + assert len(result) > 0 + assert all(isinstance(parameter, ChatAnswerParameter) for parameter in result) async def test_iterate_chat_answer_parameters(async_chat_answer_parameters_service): @@ -24,5 +28,6 @@ async def test_iterate_chat_answer_parameters(async_chat_answer_parameters_servi async def test_not_found(async_mpt_ops, chat_id): service = async_mpt_ops.helpdesk.chats.answers(chat_id).parameters("ANS-0000-0000") - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await service.fetch_page(limit=20) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/answers/parameters/test_sync_parameters.py b/tests/e2e/helpdesk/chats/answers/parameters/test_sync_parameters.py index 031fec0..52dfa57 100644 --- a/tests/e2e/helpdesk/chats/answers/parameters/test_sync_parameters.py +++ b/tests/e2e/helpdesk/chats/answers/parameters/test_sync_parameters.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_answer_parameters import ChatAnswerParameter pytestmark = [ pytest.mark.flaky, @@ -11,7 +14,8 @@ def test_list_chat_answer_parameters(chat_answer_parameters_service): result = chat_answer_parameters_service.fetch_page(limit=20) - assert len(result) >= 0 + assert len(result) > 0 + assert all(isinstance(parameter, ChatAnswerParameter) for parameter in result) def test_iterate_chat_answer_parameters(chat_answer_parameters_service): @@ -25,5 +29,7 @@ def test_iterate_chat_answer_parameters(chat_answer_parameters_service): def test_not_found(mpt_ops, chat_id): service = mpt_ops.helpdesk.chats.answers(chat_id).parameters("ANS-0000-0000") - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: service.fetch_page(limit=20) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/answers/test_async_answers.py b/tests/e2e/helpdesk/chats/answers/test_async_answers.py index 50bdd43..6d568c9 100644 --- a/tests/e2e/helpdesk/chats/answers/test_async_answers.py +++ b/tests/e2e/helpdesk/chats/answers/test_async_answers.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_answers import ChatAnswer pytestmark = [ pytest.mark.flaky, @@ -18,6 +21,7 @@ async def test_list_chat_answers(async_chat_answers_service): result = await async_chat_answers_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(answer, ChatAnswer) for answer in result) def test_create_chat_answer(async_created_chat_answer): @@ -71,5 +75,6 @@ async def test_delete_chat_answer(async_chat_answers_service, async_created_chat async def test_not_found(async_chat_answers_service, invalid_chat_answer_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_chat_answers_service.get(invalid_chat_answer_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/answers/test_sync_answers.py b/tests/e2e/helpdesk/chats/answers/test_sync_answers.py index 9c71b51..9843c4a 100644 --- a/tests/e2e/helpdesk/chats/answers/test_sync_answers.py +++ b/tests/e2e/helpdesk/chats/answers/test_sync_answers.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_answers import ChatAnswer pytestmark = [ pytest.mark.flaky, @@ -18,6 +21,7 @@ def test_list_chat_answers(chat_answers_service): result = chat_answers_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(answer, ChatAnswer) for answer in result) def test_create_chat_answer(created_chat_answer): @@ -66,5 +70,7 @@ def test_delete_chat_answer(chat_answers_service, created_chat_answer): def test_not_found(chat_answers_service, invalid_chat_answer_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: chat_answers_service.get(invalid_chat_answer_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/attachment/test_async_attachment.py b/tests/e2e/helpdesk/chats/attachment/test_async_attachment.py index aded57f..1a4a310 100644 --- a/tests/e2e/helpdesk/chats/attachment/test_async_attachment.py +++ b/tests/e2e/helpdesk/chats/attachment/test_async_attachment.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_attachments import ChatAttachment pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ async def test_list_chat_attachments(async_chat_attachments_service, async_creat result = await async_chat_attachments_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(attachment, ChatAttachment) for attachment in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -63,24 +67,27 @@ async def test_delete_chat_attachment(async_chat_attachments_service, chat_attac async def test_get_chat_attachment_not_found( async_chat_attachments_service, invalid_chat_attachment_id ): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_attachments_service.get(invalid_chat_attachment_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_update_chat_attachment_not_found( async_chat_attachments_service, invalid_chat_attachment_id ): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_attachments_service.update( invalid_chat_attachment_id, {"description": "updated description"}, ) + assert error.value.status_code == HTTPStatus.NOT_FOUND @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_delete_chat_attachment_not_found( async_chat_attachments_service, invalid_chat_attachment_id ): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_attachments_service.delete(invalid_chat_attachment_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/attachment/test_sync_attachment.py b/tests/e2e/helpdesk/chats/attachment/test_sync_attachment.py index 2b2d944..2284414 100644 --- a/tests/e2e/helpdesk/chats/attachment/test_sync_attachment.py +++ b/tests/e2e/helpdesk/chats/attachment/test_sync_attachment.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_attachments import ChatAttachment pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ def test_list_chat_attachments(chat_attachments_service, created_chat_attachment result = chat_attachments_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(attachment, ChatAttachment) for attachment in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -54,20 +58,26 @@ def test_delete_chat_attachment(chat_attachments_service, chat_attachment_data, @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_get_chat_attachment_not_found(chat_attachments_service, invalid_chat_attachment_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_attachments_service.get(invalid_chat_attachment_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND + @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_update_chat_attachment_not_found(chat_attachments_service, invalid_chat_attachment_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_attachments_service.update( invalid_chat_attachment_id, {"description": "updated description"}, ) + assert error.value.status_code == HTTPStatus.NOT_FOUND + @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_delete_chat_attachment_not_found(chat_attachments_service, invalid_chat_attachment_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_attachments_service.delete(invalid_chat_attachment_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/links/test_async_links.py b/tests/e2e/helpdesk/chats/links/test_async_links.py index 5a84bfc..4060ac9 100644 --- a/tests/e2e/helpdesk/chats/links/test_async_links.py +++ b/tests/e2e/helpdesk/chats/links/test_async_links.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_links import ChatLink pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ async def test_list_chat_links(async_chat_links_service): result = await async_chat_links_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(link, ChatLink) for link in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -40,14 +44,16 @@ async def test_delete_chat_link(async_chat_links_service, async_created_chat_lin @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_update_chat_link_not_found(async_chat_links_service, invalid_chat_link_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_links_service.update( invalid_chat_link_id, {"name": "updated name"}, ) + assert error.value.status_code == HTTPStatus.NOT_FOUND @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_delete_chat_link_not_found(async_chat_links_service, invalid_chat_link_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_links_service.delete(invalid_chat_link_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/links/test_sync_links.py b/tests/e2e/helpdesk/chats/links/test_sync_links.py index 224c080..3476963 100644 --- a/tests/e2e/helpdesk/chats/links/test_sync_links.py +++ b/tests/e2e/helpdesk/chats/links/test_sync_links.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_links import ChatLink pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ def test_list_chat_links(chat_links_service): result = chat_links_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(link, ChatLink) for link in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -37,11 +41,15 @@ def test_delete_chat_link(chat_links_service, created_chat_link): @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_update_chat_link_not_found(chat_links_service, invalid_chat_link_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_links_service.update(invalid_chat_link_id, {"name": "updated name"}) + assert error.value.status_code == HTTPStatus.NOT_FOUND + @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_delete_chat_link_not_found(chat_links_service, invalid_chat_link_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_links_service.delete(invalid_chat_link_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/messages/test_async_messages.py b/tests/e2e/helpdesk/chats/messages/test_async_messages.py index 6eb1378..7c0deca 100644 --- a/tests/e2e/helpdesk/chats/messages/test_async_messages.py +++ b/tests/e2e/helpdesk/chats/messages/test_async_messages.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_messages import ChatMessage pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ async def test_list_chat_messages(async_chat_messages_service): result = await async_chat_messages_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(message, ChatMessage) for message in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -39,14 +43,16 @@ async def test_delete_chat_message(async_chat_messages_service, async_created_ch @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_update_chat_message_not_found(async_chat_messages_service, invalid_chat_message_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_messages_service.update( invalid_chat_message_id, {"visibility": "Public"}, ) + assert error.value.status_code == HTTPStatus.NOT_FOUND @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_delete_chat_message_not_found(async_chat_messages_service, invalid_chat_message_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_messages_service.delete(invalid_chat_message_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/messages/test_sync_messages.py b/tests/e2e/helpdesk/chats/messages/test_sync_messages.py index 79413b2..eb6d69c 100644 --- a/tests/e2e/helpdesk/chats/messages/test_sync_messages.py +++ b/tests/e2e/helpdesk/chats/messages/test_sync_messages.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_messages import ChatMessage pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ def test_list_chat_messages(chat_messages_service): result = chat_messages_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(message, ChatMessage) for message in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -34,11 +38,15 @@ def test_delete_chat_message(chat_messages_service, created_chat_message): @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_update_chat_message_not_found(chat_messages_service, invalid_chat_message_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_messages_service.update(invalid_chat_message_id, {"visibility": "Public"}) + assert error.value.status_code == HTTPStatus.NOT_FOUND + @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_delete_chat_message_not_found(chat_messages_service, invalid_chat_message_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_messages_service.delete(invalid_chat_message_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/participants/test_async_participants.py b/tests/e2e/helpdesk/chats/participants/test_async_participants.py index 7bdd916..4b086f0 100644 --- a/tests/e2e/helpdesk/chats/participants/test_async_participants.py +++ b/tests/e2e/helpdesk/chats/participants/test_async_participants.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_participants import ChatParticipant pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ async def test_list_chat_participants(async_chat_participants_service): result = await async_chat_participants_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(participant, ChatParticipant) for participant in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -42,16 +46,18 @@ async def test_delete_chat_participant( async def test_update_chat_participant_not_found( async_chat_participants_service, invalid_chat_participant_id ): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_participants_service.update( invalid_chat_participant_id, {"status": "Active"}, ) + assert error.value.status_code == HTTPStatus.NOT_FOUND @pytest.mark.skip(reason="Unskip after MPT-19124 completed") async def test_delete_chat_participant_not_found( async_chat_participants_service, invalid_chat_participant_id ): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: await async_chat_participants_service.delete(invalid_chat_participant_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/participants/test_sync_participants.py b/tests/e2e/helpdesk/chats/participants/test_sync_participants.py index 27f806d..7d45e9a 100644 --- a/tests/e2e/helpdesk/chats/participants/test_sync_participants.py +++ b/tests/e2e/helpdesk/chats/participants/test_sync_participants.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chat_participants import ChatParticipant pytestmark = [pytest.mark.flaky] @@ -10,6 +13,7 @@ def test_list_chat_participants(chat_participants_service): result = chat_participants_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(participant, ChatParticipant) for participant in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01 @@ -33,11 +37,15 @@ def test_delete_chat_participant(chat_participants_service, created_chat_partici @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_update_chat_participant_not_found(chat_participants_service, invalid_chat_participant_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_participants_service.update(invalid_chat_participant_id, {"status": "Active"}) + assert error.value.status_code == HTTPStatus.NOT_FOUND + @pytest.mark.skip(reason="Unskip after MPT-19124 completed") def test_delete_chat_participant_not_found(chat_participants_service, invalid_chat_participant_id): - with pytest.raises(MPTAPIError, match=r"404 Not Found"): + with pytest.raises(MPTAPIError) as error: chat_participants_service.delete(invalid_chat_participant_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/test_async_chats.py b/tests/e2e/helpdesk/chats/test_async_chats.py index 39b6e75..b29d445 100644 --- a/tests/e2e/helpdesk/chats/test_async_chats.py +++ b/tests/e2e/helpdesk/chats/test_async_chats.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chats import Chat pytestmark = [pytest.mark.flaky] @@ -19,6 +22,7 @@ async def test_list_chats(async_mpt_ops): result = await service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(chat, Chat) for chat in result) async def test_update_chat(async_mpt_ops, chat_id, short_uuid): @@ -34,5 +38,6 @@ async def test_update_chat(async_mpt_ops, chat_id, short_uuid): async def test_not_found(async_mpt_ops, invalid_chat_id): service = async_mpt_ops.helpdesk.chats - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await service.get(invalid_chat_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/chats/test_sync_chats.py b/tests/e2e/helpdesk/chats/test_sync_chats.py index 31c8c52..ebf3661 100644 --- a/tests/e2e/helpdesk/chats/test_sync_chats.py +++ b/tests/e2e/helpdesk/chats/test_sync_chats.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.chats import Chat pytestmark = [pytest.mark.flaky] @@ -19,6 +22,7 @@ def test_list_chats(mpt_ops): result = service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(chat, Chat) for chat in result) def test_update_chat(mpt_ops, chat_id, short_uuid): @@ -34,5 +38,7 @@ def test_update_chat(mpt_ops, chat_id, short_uuid): def test_not_found(mpt_ops, invalid_chat_id): service = mpt_ops.helpdesk.chats - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: service.get(invalid_chat_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/forms/test_async_forms.py b/tests/e2e/helpdesk/forms/test_async_forms.py index 611988c..e2356f9 100644 --- a/tests/e2e/helpdesk/forms/test_async_forms.py +++ b/tests/e2e/helpdesk/forms/test_async_forms.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.forms import Form pytestmark = [pytest.mark.flaky] @@ -17,6 +20,7 @@ async def test_list_forms(async_mpt_ops): result = await async_mpt_ops.helpdesk.forms.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(form, Form) for form in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") @@ -56,5 +60,6 @@ async def test_delete_form(async_mpt_ops, async_created_form): async def test_not_found(async_mpt_ops, invalid_form_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_mpt_ops.helpdesk.forms.get(invalid_form_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/forms/test_sync_forms.py b/tests/e2e/helpdesk/forms/test_sync_forms.py index 3100f68..26e7e76 100644 --- a/tests/e2e/helpdesk/forms/test_sync_forms.py +++ b/tests/e2e/helpdesk/forms/test_sync_forms.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.forms import Form pytestmark = [pytest.mark.flaky] @@ -17,6 +20,7 @@ def test_list_forms(mpt_ops): result = mpt_ops.helpdesk.forms.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(form, Form) for form in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") @@ -56,5 +60,7 @@ def test_delete_form(mpt_ops, created_form): def test_not_found(mpt_ops, invalid_form_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: mpt_ops.helpdesk.forms.get(invalid_form_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/parameter_groups/parameters/test_async_parameters.py b/tests/e2e/helpdesk/parameter_groups/parameters/test_async_parameters.py index a6c78a9..40a1d0f 100644 --- a/tests/e2e/helpdesk/parameter_groups/parameters/test_async_parameters.py +++ b/tests/e2e/helpdesk/parameter_groups/parameters/test_async_parameters.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.parameter_group_parameters import ParameterGroupParameter pytestmark = [ pytest.mark.flaky, @@ -23,6 +26,8 @@ async def test_list_parameter_group_parameters( ): result = await async_parameter_group_parameters_service.fetch_page(limit=20) + assert len(result) > 0 + assert all(isinstance(parameter, ParameterGroupParameter) for parameter in result) assert any(parameter.id == async_created_parameter_group_parameter.id for parameter in result) @@ -57,5 +62,6 @@ async def test_delete_parameter_group_parameter( async def test_not_found( async_parameter_group_parameters_service, invalid_parameter_group_parameter_id ): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_parameter_group_parameters_service.get(invalid_parameter_group_parameter_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/parameter_groups/parameters/test_sync_parameters.py b/tests/e2e/helpdesk/parameter_groups/parameters/test_sync_parameters.py index 9149f05..231548b 100644 --- a/tests/e2e/helpdesk/parameter_groups/parameters/test_sync_parameters.py +++ b/tests/e2e/helpdesk/parameter_groups/parameters/test_sync_parameters.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.parameter_group_parameters import ParameterGroupParameter pytestmark = [ pytest.mark.flaky, @@ -21,6 +24,8 @@ def test_list_parameter_group_parameters( ): result = parameter_group_parameters_service.fetch_page(limit=20) + assert len(result) > 0 + assert all(isinstance(parameter, ParameterGroupParameter) for parameter in result) assert any(parameter.id == created_parameter_group_parameter.id for parameter in result) @@ -50,5 +55,7 @@ def test_delete_parameter_group_parameter( def test_not_found(parameter_group_parameters_service, invalid_parameter_group_parameter_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: parameter_group_parameters_service.get(invalid_parameter_group_parameter_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/parameter_groups/test_async_parameter_groups.py b/tests/e2e/helpdesk/parameter_groups/test_async_parameter_groups.py index b519373..bf3ca84 100644 --- a/tests/e2e/helpdesk/parameter_groups/test_async_parameter_groups.py +++ b/tests/e2e/helpdesk/parameter_groups/test_async_parameter_groups.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.parameter_groups import ParameterGroup pytestmark = [ pytest.mark.flaky, @@ -18,6 +21,7 @@ async def test_list_parameter_groups(async_parameter_groups_service): result = await async_parameter_groups_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(parameter_group, ParameterGroup) for parameter_group in result) def test_create_parameter_group(async_created_parameter_group): @@ -46,5 +50,6 @@ async def test_delete_parameter_group( async def test_not_found(async_parameter_groups_service, invalid_parameter_group_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_parameter_groups_service.get(invalid_parameter_group_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/parameter_groups/test_sync_parameter_groups.py b/tests/e2e/helpdesk/parameter_groups/test_sync_parameter_groups.py index e2c6402..415103f 100644 --- a/tests/e2e/helpdesk/parameter_groups/test_sync_parameter_groups.py +++ b/tests/e2e/helpdesk/parameter_groups/test_sync_parameter_groups.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.parameter_groups import ParameterGroup pytestmark = [ pytest.mark.flaky, @@ -18,6 +21,7 @@ def test_list_parameter_groups(parameter_groups_service): result = parameter_groups_service.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(parameter_group, ParameterGroup) for parameter_group in result) def test_create_parameter_group(created_parameter_group): @@ -40,5 +44,7 @@ def test_delete_parameter_group(parameter_groups_service, created_parameter_grou def test_not_found(parameter_groups_service, invalid_parameter_group_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: parameter_groups_service.get(invalid_parameter_group_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/parameters/test_async_parameters.py b/tests/e2e/helpdesk/parameters/test_async_parameters.py index 0bbf4dd..d12988c 100644 --- a/tests/e2e/helpdesk/parameters/test_async_parameters.py +++ b/tests/e2e/helpdesk/parameters/test_async_parameters.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.parameters import Parameter pytestmark = [ pytest.mark.flaky, @@ -18,6 +21,7 @@ async def test_list_parameters(async_mpt_ops): result = await async_mpt_ops.helpdesk.parameters.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(parameter, Parameter) for parameter in result) def test_create_parameter(async_created_parameter): @@ -40,5 +44,6 @@ async def test_delete_parameter(async_mpt_ops, async_created_parameter): async def test_not_found(async_mpt_ops, invalid_parameter_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_mpt_ops.helpdesk.parameters.get(invalid_parameter_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/parameters/test_sync_parameters.py b/tests/e2e/helpdesk/parameters/test_sync_parameters.py index aa857be..6be08d8 100644 --- a/tests/e2e/helpdesk/parameters/test_sync_parameters.py +++ b/tests/e2e/helpdesk/parameters/test_sync_parameters.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.parameters import Parameter pytestmark = [ pytest.mark.flaky, @@ -18,6 +21,7 @@ def test_list_parameters(mpt_ops): result = mpt_ops.helpdesk.parameters.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(parameter, Parameter) for parameter in result) def test_create_parameter(created_parameter): @@ -40,5 +44,7 @@ def test_delete_parameter(mpt_ops, created_parameter): def test_not_found(mpt_ops, invalid_parameter_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: mpt_ops.helpdesk.parameters.get(invalid_parameter_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/queues/test_async_queues.py b/tests/e2e/helpdesk/queues/test_async_queues.py index 13bb3ba..ddbb0c0 100644 --- a/tests/e2e/helpdesk/queues/test_async_queues.py +++ b/tests/e2e/helpdesk/queues/test_async_queues.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.queues import Queue pytestmark = [pytest.mark.flaky] @@ -17,6 +20,7 @@ async def test_list_queues(async_mpt_ops): result = await async_mpt_ops.helpdesk.queues.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(queue, Queue) for queue in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") @@ -56,5 +60,6 @@ async def test_delete_queue(async_mpt_ops, async_created_queue): async def test_not_found(async_mpt_ops, invalid_queue_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: await async_mpt_ops.helpdesk.queues.get(invalid_queue_id) + assert error.value.status_code == HTTPStatus.NOT_FOUND diff --git a/tests/e2e/helpdesk/queues/test_sync_queues.py b/tests/e2e/helpdesk/queues/test_sync_queues.py index f54920b..5e2136c 100644 --- a/tests/e2e/helpdesk/queues/test_sync_queues.py +++ b/tests/e2e/helpdesk/queues/test_sync_queues.py @@ -1,6 +1,9 @@ +from http import HTTPStatus + import pytest from mpt_api_client.exceptions import MPTAPIError +from mpt_api_client.resources.helpdesk.queues import Queue pytestmark = [pytest.mark.flaky] @@ -17,6 +20,7 @@ def test_list_queues(mpt_ops): result = mpt_ops.helpdesk.queues.fetch_page(limit=1) assert len(result) > 0 + assert all(isinstance(queue, Queue) for queue in result) @pytest.mark.skip(reason="Unskip after MPT-19124 completed") @@ -56,5 +60,7 @@ def test_delete_queue(mpt_ops, created_queue): def test_not_found(mpt_ops, invalid_queue_id): - with pytest.raises(MPTAPIError): + with pytest.raises(MPTAPIError) as error: mpt_ops.helpdesk.queues.get(invalid_queue_id) + + assert error.value.status_code == HTTPStatus.NOT_FOUND