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
1 change: 1 addition & 0 deletions e2e_config.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 6 additions & 3 deletions tests/e2e/helpdesk/cases/test_async_cases.py
Original file line number Diff line number Diff line change
@@ -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]

Expand All @@ -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")
Expand Down Expand Up @@ -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
10 changes: 7 additions & 3 deletions tests/e2e/helpdesk/cases/test_sync_cases.py
Original file line number Diff line number Diff line change
@@ -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]

Expand All @@ -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")
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/e2e/helpdesk/channels/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/helpdesk/channels/messages/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

Original file line number Diff line number Diff line change
@@ -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]

Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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]

Expand All @@ -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
14 changes: 7 additions & 7 deletions tests/e2e/helpdesk/channels/test_async_channels.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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}"
Expand All @@ -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

Expand All @@ -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
15 changes: 8 additions & 7 deletions tests/e2e/helpdesk/channels/test_sync_channels.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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}"
Expand All @@ -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

Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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):
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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):
Expand All @@ -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
7 changes: 6 additions & 1 deletion tests/e2e/helpdesk/chats/answers/test_async_answers.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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):
Expand Down Expand Up @@ -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
8 changes: 7 additions & 1 deletion tests/e2e/helpdesk/chats/answers/test_sync_answers.py
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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):
Expand Down Expand Up @@ -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
Loading
Loading