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
52 changes: 0 additions & 52 deletions tests/e2e/helpdesk/cases/conftest.py

This file was deleted.

8 changes: 4 additions & 4 deletions tests/e2e/helpdesk/chats/attachment/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@


@pytest.fixture
def chat_attachments_service(mpt_ops, chat_id):
return mpt_ops.helpdesk.chats.attachments(chat_id)
def chat_attachments_service(mpt_ops, created_chat):
return mpt_ops.helpdesk.chats.attachments(created_chat.id)


@pytest.fixture
def async_chat_attachments_service(async_mpt_ops, chat_id):
return async_mpt_ops.helpdesk.chats.attachments(chat_id)
def async_chat_attachments_service(async_mpt_ops, created_chat):
return async_mpt_ops.helpdesk.chats.attachments(created_chat.id)


@pytest.fixture
Expand Down
12 changes: 4 additions & 8 deletions tests/e2e/helpdesk/chats/attachment/test_async_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,24 @@
pytestmark = [pytest.mark.flaky]


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
async def test_list_chat_attachments(async_chat_attachments_service, async_created_chat_attachment):
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
def test_create_chat_attachment(async_created_chat_attachment, chat_attachment_data):
def test_create_chat_attachment(async_created_chat_attachment, chat_attachment_data): # noqa: AAA01
assert async_created_chat_attachment.id is not None
assert async_created_chat_attachment.to_dict().get("name") == chat_attachment_data["name"]


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
async def test_get_chat_attachment(async_chat_attachments_service, async_created_chat_attachment):
result = await async_chat_attachments_service.get(async_created_chat_attachment.id)

assert result.id == async_created_chat_attachment.id


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
async def test_update_chat_attachment(
async_chat_attachments_service, async_created_chat_attachment, short_uuid
):
Expand All @@ -44,7 +40,6 @@ async def test_update_chat_attachment(
assert result.to_dict().get("name") == updated_name


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
async def test_download_chat_attachment(
async_chat_attachments_service, async_created_chat_attachment
):
Expand All @@ -56,11 +51,12 @@ async def test_download_chat_attachment(
assert result.file_contents is not None


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
async def test_delete_chat_attachment(async_chat_attachments_service, chat_attachment_data, pdf_fd):
created = await async_chat_attachments_service.create(chat_attachment_data, file=pdf_fd)

await async_chat_attachments_service.delete(created.id)
result = await async_chat_attachments_service.delete(created.id)

assert result is None


async def test_get_chat_attachment_not_found(
Expand Down
12 changes: 4 additions & 8 deletions tests/e2e/helpdesk/chats/attachment/test_sync_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,24 @@
pytestmark = [pytest.mark.flaky]


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
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
def test_create_chat_attachment(created_chat_attachment, chat_attachment_data):
def test_create_chat_attachment(created_chat_attachment, chat_attachment_data): # noqa: AAA01
assert created_chat_attachment.id is not None
assert created_chat_attachment.to_dict().get("name") == chat_attachment_data["name"]


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
def test_get_chat_attachment(chat_attachments_service, created_chat_attachment):
result = chat_attachments_service.get(created_chat_attachment.id)

assert result.id == created_chat_attachment.id


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
def test_update_chat_attachment(chat_attachments_service, created_chat_attachment, short_uuid):
updated_name = f"e2e updated attachment - {short_uuid}"

Expand All @@ -42,18 +38,18 @@ def test_update_chat_attachment(chat_attachments_service, created_chat_attachmen
assert result.to_dict().get("name") == updated_name


@pytest.mark.skip(reason="Unskip after MPT-19124 completed")
def test_download_chat_attachment(chat_attachments_service, created_chat_attachment):
result = chat_attachments_service.download(created_chat_attachment.id, accept="application/pdf")

assert result.file_contents is not None


@pytest.mark.skip(reason="Unskip after MPT-19124 completed") # noqa: AAA01
def test_delete_chat_attachment(chat_attachments_service, chat_attachment_data, pdf_fd):
created = chat_attachments_service.create(chat_attachment_data, file=pdf_fd)

chat_attachments_service.delete(created.id)
result = chat_attachments_service.delete(created.id)

assert result is None


def test_get_chat_attachment_not_found(chat_attachments_service, invalid_chat_attachment_id):
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/helpdesk/chats/messages/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@


@pytest.fixture
def chat_messages_service(mpt_ops, chat_id):
return mpt_ops.helpdesk.chats.messages(chat_id)
def chat_messages_service(mpt_ops, created_chat):
return mpt_ops.helpdesk.chats.messages(created_chat.id)


@pytest.fixture
def async_chat_messages_service(async_mpt_ops, chat_id):
return async_mpt_ops.helpdesk.chats.messages(chat_id)
def async_chat_messages_service(async_mpt_ops, created_chat):
return async_mpt_ops.helpdesk.chats.messages(created_chat.id)


@pytest.fixture
Expand Down
50 changes: 50 additions & 0 deletions tests/e2e/helpdesk/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,53 @@ async def async_created_disabled_queue(async_mpt_ops, async_created_queue):
assert result.status == "Disabled"

return result


@pytest.fixture(scope="session")
def invalid_case_id():
return "CAS-0000-0000"


@pytest.fixture
def case_data(created_queue):
return {
"queue": {"id": created_queue.id},
"chat": {"lastMessage": {"content": "E2E testing!!!"}},
}


@pytest.fixture
def created_case(mpt_ops, case_data):
return mpt_ops.helpdesk.cases.create(case_data)


@pytest.fixture
def queried_case(mpt_ops, created_case):
return mpt_ops.helpdesk.cases.query(created_case.id, {"queryPrompt": "More details needed"})


@pytest.fixture
def processed_case(mpt_ops, queried_case):
return mpt_ops.helpdesk.cases.process(queried_case.id)


@pytest.fixture
def created_chat(created_case):
return created_case.chat


@pytest.fixture
async def async_created_case(async_mpt_ops, case_data):
return await async_mpt_ops.helpdesk.cases.create(case_data)


@pytest.fixture
async def async_queried_case(async_mpt_ops, async_created_case):
return await async_mpt_ops.helpdesk.cases.query(
async_created_case.id, {"queryPrompt": "More details needed"}
)


@pytest.fixture
async def async_processed_case(async_mpt_ops, async_queried_case):
return await async_mpt_ops.helpdesk.cases.process(async_queried_case.id)