Skip to content

MPT-19484 modify test cases and update fixtures for queues and cases#266

Merged
jentyk merged 1 commit intomainfrom
feat/MPT-19484
Mar 31, 2026
Merged

MPT-19484 modify test cases and update fixtures for queues and cases#266
jentyk merged 1 commit intomainfrom
feat/MPT-19484

Conversation

@jentyk
Copy link
Copy Markdown
Member

@jentyk jentyk commented Mar 31, 2026

Closes MPT-19484

Release Notes

  • Updated case_factory fixture to depend on created_queue fixture and modified payload to use queue ID instead of case definition fields
  • Removed skip markers from test_update_case and test_query_case test methods in async test suite
  • Changed test_update_case assertion logic to verify awaiting field instead of description field
  • Updated test_query_case to accept short_uuid parameter and verify queryPrompt field matching
  • Removed pre-call to process() in sync test_query_case and updated query assertions
  • Updated sync test_update_case to verify awaiting state changes instead of description updates

@jentyk jentyk requested a review from a team as a code owner March 31, 2026 16:54
@jentyk jentyk requested review from albertsola and d3rky March 31, 2026 16:54
@sonarqubecloud
Copy link
Copy Markdown

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

📝 Walkthrough

Walkthrough

E2E test fixtures and cases are updated to restructure the case factory payload, replacing title/description/priority/type fields with queue and chat.lastMessage.content. Tests for case updates and queries are enabled and refactored to verify awaiting state and queryPrompt assertions instead of description modifications.

Changes

Cohort / File(s) Summary
Case Factory Configuration
tests/e2e/helpdesk/cases/conftest.py
Updated case_factory fixture to depend on created_queue and changed returned payload to use queue.id and include chat.lastMessage.content field.
Test Case Updates
tests/e2e/helpdesk/cases/test_async_cases.py, tests/e2e/helpdesk/cases/test_sync_cases.py
Removed skip markers and refactored assertions: test_update_case now verifies awaiting field state; test_query_case signature updated to include short_uuid parameter and assertions verify exact queryPrompt match instead of null checks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #241 — Directly modifies the same conftest.py and test files to update fixture signatures, payload fields, and test assertion logic for case operations.
  • PR #243 — Introduces and relies on the created_queue fixture that is now integrated into case payloads via the updated case_factory.
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Jira Issue Key In Title ✅ Passed The PR title contains exactly one Jira issue key (MPT-19484) in the correct format at the beginning.
Test Coverage Required ✅ Passed The pull request only modifies test files within the tests/ directory, satisfying the check requirements.
Single Commit Required ✅ Passed The PR contains exactly one commit (b651605) with all changes properly consolidated, satisfying the single commit requirement.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
tests/e2e/helpdesk/cases/test_sync_cases.py (1)

51-56: Extract queryPrompt into 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: Align case_factory parameters 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

📥 Commits

Reviewing files that changed from the base of the PR and between 15cbec0 and b651605.

📒 Files selected for processing (4)
  • tests/e2e/helpdesk/cases/conftest.py
  • tests/e2e/helpdesk/cases/test_async_cases.py
  • tests/e2e/helpdesk/cases/test_sync_cases.py
  • tests/e2e/helpdesk/conftest.py

@jentyk jentyk merged commit 66fad1e into main Mar 31, 2026
4 checks passed
@jentyk jentyk deleted the feat/MPT-19484 branch March 31, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants