MPT-19484 modify test cases and update fixtures for queues and cases#266
MPT-19484 modify test cases and update fixtures for queues and cases#266
Conversation
|
📝 WalkthroughWalkthroughE2E test fixtures and cases are updated to restructure the case factory payload, replacing Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
tests/e2e/helpdesk/cases/test_sync_cases.py (1)
51-56: ExtractqueryPromptinto one local variable to avoid drift.You currently build the same prompt twice. Defining it once improves maintainability and failure readability.
Small refactor
def test_query_case(mpt_ops, created_case, short_uuid): + query_prompt = f"e2e update {short_uuid}" result = mpt_ops.helpdesk.cases.query( - created_case.id, {"queryPrompt": f"e2e update {short_uuid}"} + created_case.id, {"queryPrompt": query_prompt} ) - assert result.to_dict().get("queryPrompt") == f"e2e update {short_uuid}" + assert result.to_dict().get("queryPrompt") == query_prompt🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/helpdesk/cases/test_sync_cases.py` around lines 51 - 56, In test_query_case, avoid duplicating the prompt string by extracting the prompt into a local variable (e.g., prompt = f"e2e update {short_uuid}") and use that variable in the call to mpt_ops.helpdesk.cases.query(created_case.id, {"queryPrompt": prompt}) and in the assertion (result.to_dict().get("queryPrompt") == prompt); update references in the test_query_case function accordingly to improve maintainability and clearer failures.tests/e2e/helpdesk/cases/conftest.py (1)
10-18: Aligncase_factoryparameters with what the payload actually uses.
factory(title, description)suggests customizable content, but those values are currently ignored. Please either remove these parameters or wire one of them into the payload to avoid misleading call sites.Proposed cleanup
`@pytest.fixture` def case_factory(short_uuid, created_queue): - def factory( - title: str = "E2E Created Helpdesk Case", - description: str = "E2E Created Helpdesk Case Description", - ): + def factory(): return { "queue": {"id": created_queue.id}, "chat": {"lastMessage": {"content": "E2E testing!!!"}}, } return factory🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/helpdesk/cases/conftest.py` around lines 10 - 18, The factory nested inside case_factory currently accepts title and description but never uses them, so update the implementation of case_factory/factory to either remove those unused parameters or wire them into the returned payload; for example, populate "chat.lastMessage.content" (or add a "description" field in the payload) from the title/description parameters, and ensure callers of case_factory(short_uuid, created_queue) that expect to override content will work by referencing the factory(title, description) signature.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/e2e/helpdesk/cases/conftest.py`:
- Around line 10-18: The factory nested inside case_factory currently accepts
title and description but never uses them, so update the implementation of
case_factory/factory to either remove those unused parameters or wire them into
the returned payload; for example, populate "chat.lastMessage.content" (or add a
"description" field in the payload) from the title/description parameters, and
ensure callers of case_factory(short_uuid, created_queue) that expect to
override content will work by referencing the factory(title, description)
signature.
In `@tests/e2e/helpdesk/cases/test_sync_cases.py`:
- Around line 51-56: In test_query_case, avoid duplicating the prompt string by
extracting the prompt into a local variable (e.g., prompt = f"e2e update
{short_uuid}") and use that variable in the call to
mpt_ops.helpdesk.cases.query(created_case.id, {"queryPrompt": prompt}) and in
the assertion (result.to_dict().get("queryPrompt") == prompt); update references
in the test_query_case function accordingly to improve maintainability and
clearer failures.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 96775824-c4f4-4b18-902e-6ec649cccb5b
📒 Files selected for processing (4)
tests/e2e/helpdesk/cases/conftest.pytests/e2e/helpdesk/cases/test_async_cases.pytests/e2e/helpdesk/cases/test_sync_cases.pytests/e2e/helpdesk/conftest.py



Closes MPT-19484
Release Notes
case_factoryfixture to depend oncreated_queuefixture and modified payload to use queue ID instead of case definition fieldstest_update_caseandtest_query_casetest methods in async test suitetest_update_caseassertion logic to verifyawaitingfield instead ofdescriptionfieldtest_query_caseto acceptshort_uuidparameter and verifyqueryPromptfield matchingprocess()in synctest_query_caseand updated query assertionstest_update_caseto verifyawaitingstate changes instead of description updates