Skip to content

Commit 08be40f

Browse files
authored
Merge pull request #272
MPT-19489 refactor fixtures to replace chat_id with created_chat
2 parents 5340a75 + 765146e commit 08be40f

32 files changed

+91
-103
lines changed

e2e_config.test.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@
5656
"commerce.product.listing.id": "LST-5489-0806",
5757
"commerce.product.template.id": "TPL-1767-7355-0002",
5858
"commerce.user.id": "USR-4303-2348",
59-
"helpdesk.chat.id": "CHT-5064-0262-3671",
60-
"helpdesk.channel.id": "CHL-5064-0262-3671",
6159
"commerce.subscription.agreement.id": "AGR-2473-3299-1721",
6260
"commerce.subscription.id": "SUB-3678-1831-2188",
6361
"commerce.subscription.product.item.id": "ITM-1767-7355-0001",

tests/e2e/helpdesk/cases/test_async_cases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
async def test_get_case(async_mpt_ops, async_created_case):
1212
result = await async_mpt_ops.helpdesk.cases.get(async_created_case.id)
1313

14-
assert result.id == async_created_case.id
14+
assert isinstance(result, Case)
1515

1616

1717
async def test_list_cases(async_mpt_ops):
@@ -26,7 +26,7 @@ async def test_list_cases(async_mpt_ops):
2626
def test_create_case(async_created_case):
2727
result = async_created_case
2828

29-
assert result is not None
29+
assert isinstance(result, Case)
3030

3131

3232
async def test_update_case(async_mpt_ops, async_created_case, short_uuid):
@@ -35,7 +35,7 @@ async def test_update_case(async_mpt_ops, async_created_case, short_uuid):
3535

3636
result = await async_mpt_ops.helpdesk.cases.update(async_created_case.id, update_data)
3737

38-
assert result.id == async_created_case.id
38+
assert isinstance(result, Case)
3939
assert result.to_dict().get("awaiting") is True
4040

4141

tests/e2e/helpdesk/cases/test_sync_cases.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def test_get_case(mpt_ops, created_case):
1212
result = mpt_ops.helpdesk.cases.get(created_case.id)
1313

14-
assert result.id == created_case.id
14+
assert isinstance(result, Case)
1515

1616

1717
def test_list_cases(mpt_ops):
@@ -26,7 +26,7 @@ def test_list_cases(mpt_ops):
2626
def test_create_case(created_case):
2727
result = created_case
2828

29-
assert result is not None
29+
assert isinstance(result, Case)
3030

3131

3232
def test_update_case(mpt_ops, created_case, short_uuid):
@@ -35,7 +35,7 @@ def test_update_case(mpt_ops, created_case, short_uuid):
3535

3636
result = mpt_ops.helpdesk.cases.update(created_case.id, update_data)
3737

38-
assert result.id == created_case.id
38+
assert isinstance(result, Case)
3939
assert result.to_dict().get("awaiting") is True
4040

4141

tests/e2e/helpdesk/channels/conftest.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
)
77

88

9-
@pytest.fixture(scope="session")
10-
def channel_id(e2e_config):
11-
return e2e_config["helpdesk.channel.id"] # FIXME: seed data
12-
13-
149
@pytest.fixture(scope="session")
1510
def invalid_channel_id():
1611
return "CHN-0000-0000-0000"

tests/e2e/helpdesk/channels/test_async_channels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async def test_get_channel(async_mpt_ops, channel_id):
1313

1414
result = await service.get(channel_id)
1515

16-
assert result.id == channel_id
16+
assert isinstance(result, Channel)
1717

1818

1919
async def test_list_channels(async_mpt_ops):
@@ -28,7 +28,7 @@ async def test_list_channels(async_mpt_ops):
2828
def test_create_channel(async_created_channel):
2929
result = async_created_channel
3030

31-
assert result.id is not None
31+
assert isinstance(result, Channel)
3232

3333

3434
async def test_update_channel(async_mpt_ops, async_created_channel, short_uuid):
@@ -37,7 +37,7 @@ async def test_update_channel(async_mpt_ops, async_created_channel, short_uuid):
3737

3838
result = await service.update(async_created_channel.id, {"name": new_name})
3939

40-
assert result.id == async_created_channel.id
40+
assert isinstance(result, Channel)
4141
assert result.to_dict().get("name") == new_name
4242

4343

tests/e2e/helpdesk/channels/test_sync_channels.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_get_channel(mpt_ops, channel_id):
1313

1414
result = service.get(channel_id)
1515

16-
assert result.id == channel_id
16+
assert isinstance(result, Channel)
1717

1818

1919
def test_list_channels(mpt_ops):
@@ -28,7 +28,7 @@ def test_list_channels(mpt_ops):
2828
def test_create_channel(created_channel):
2929
result = created_channel
3030

31-
assert result.id is not None
31+
assert isinstance(result, Channel)
3232

3333

3434
def test_update_channel(mpt_ops, created_channel, short_uuid):
@@ -37,7 +37,7 @@ def test_update_channel(mpt_ops, created_channel, short_uuid):
3737

3838
result = service.update(created_channel.id, {"name": new_name})
3939

40-
assert result.id == created_channel.id
40+
assert isinstance(result, Channel)
4141
assert result.to_dict().get("name") == new_name
4242

4343

tests/e2e/helpdesk/chats/answers/parameters/test_async_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async def test_iterate_chat_answer_parameters(async_chat_answer_parameters_servi
2222
iterator = async_chat_answer_parameters_service.iterate(limit=20)
2323
result = await anext(iterator, None)
2424

25-
assert result is None or result.id is not None
25+
assert isinstance(result, ChatAnswerParameter)
2626

2727

2828
async def test_not_found(async_mpt_ops, chat_id):

tests/e2e/helpdesk/chats/answers/parameters/test_sync_parameters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_iterate_chat_answer_parameters(chat_answer_parameters_service):
2323

2424
result = next(iterator, None)
2525

26-
assert result is None or result.id is not None
26+
assert isinstance(result, ChatAnswerParameter)
2727

2828

2929
def test_not_found(mpt_ops, chat_id):

tests/e2e/helpdesk/chats/answers/test_async_answers.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
async def test_get_chat_answer(async_chat_answers_service, async_created_chat_answer):
1515
result = await async_chat_answers_service.get(async_created_chat_answer.id)
1616

17-
assert result.id == async_created_chat_answer.id
17+
assert isinstance(result, ChatAnswer)
1818

1919

2020
async def test_list_chat_answers(async_chat_answers_service):
@@ -27,7 +27,7 @@ async def test_list_chat_answers(async_chat_answers_service):
2727
def test_create_chat_answer(async_created_chat_answer):
2828
result = async_created_chat_answer
2929

30-
assert result is not None
30+
assert isinstance(result, ChatAnswer)
3131

3232

3333
async def test_update_chat_answer(
@@ -37,22 +37,22 @@ async def test_update_chat_answer(
3737

3838
result = await async_chat_answers_service.update(async_created_chat_answer.id, update_data)
3939

40-
assert result.id == async_created_chat_answer.id
40+
assert isinstance(result, ChatAnswer)
4141
assert result.to_dict().get("name") == update_data["name"]
4242

4343

4444
async def test_submit_chat_answer(async_chat_answers_service, async_created_chat_answer):
4545
result = await async_chat_answers_service.submit(async_created_chat_answer.id)
4646

47-
assert result is not None
47+
assert isinstance(result, ChatAnswer)
4848

4949

5050
async def test_query_chat_answer(async_chat_answers_service, async_created_chat_answer):
5151
submitted_chat_answer = await async_chat_answers_service.submit(async_created_chat_answer.id)
5252

5353
result = await async_chat_answers_service.query(submitted_chat_answer.id)
5454

55-
assert result is not None
55+
assert isinstance(result, ChatAnswer)
5656

5757

5858
async def test_validate_chat_answer(async_chat_answers_service, async_created_chat_answer):
@@ -61,13 +61,13 @@ async def test_validate_chat_answer(async_chat_answers_service, async_created_ch
6161
{"parameters": []},
6262
)
6363

64-
assert result is not None
64+
assert isinstance(result, ChatAnswer)
6565

6666

6767
async def test_accept_chat_answer(async_chat_answers_service, async_created_chat_answer):
6868
result = await async_chat_answers_service.accept(async_created_chat_answer.id)
6969

70-
assert result is not None
70+
assert isinstance(result, ChatAnswer)
7171

7272

7373
async def test_delete_chat_answer(async_chat_answers_service, async_created_chat_answer):

tests/e2e/helpdesk/chats/answers/test_sync_answers.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,42 +27,42 @@ def test_list_chat_answers(chat_answers_service):
2727
def test_create_chat_answer(created_chat_answer):
2828
result = created_chat_answer
2929

30-
assert result is not None
30+
assert isinstance(result, ChatAnswer)
3131

3232

3333
def test_update_chat_answer(chat_answers_service, created_chat_answer, short_uuid):
3434
update_data = {"name": f"e2e updated answer {short_uuid}"}
3535

3636
result = chat_answers_service.update(created_chat_answer.id, update_data)
3737

38-
assert result.id == created_chat_answer.id
38+
assert isinstance(result, ChatAnswer)
3939
assert result.to_dict().get("name") == update_data["name"]
4040

4141

4242
def test_submit_chat_answer(chat_answers_service, created_chat_answer):
4343
result = chat_answers_service.submit(created_chat_answer.id)
4444

45-
assert result is not None
45+
assert isinstance(result, ChatAnswer)
4646

4747

4848
def test_query_chat_answer(chat_answers_service, created_chat_answer):
4949
submitted_chat_answer = chat_answers_service.submit(created_chat_answer.id)
5050

5151
result = chat_answers_service.query(submitted_chat_answer.id)
5252

53-
assert result is not None
53+
assert isinstance(result, ChatAnswer)
5454

5555

5656
def test_validate_chat_answer(chat_answers_service, created_chat_answer):
5757
result = chat_answers_service.validate(created_chat_answer.id, {"parameters": []})
5858

59-
assert result is not None
59+
assert isinstance(result, ChatAnswer)
6060

6161

6262
def test_accept_chat_answer(chat_answers_service, created_chat_answer):
6363
result = chat_answers_service.accept(created_chat_answer.id)
6464

65-
assert result is not None
65+
assert isinstance(result, ChatAnswer)
6666

6767

6868
def test_delete_chat_answer(chat_answers_service, created_chat_answer):

0 commit comments

Comments
 (0)