Conversation
AI Generated. Add a dedicated queries module for spotlight with full sync and async endpoint coverage. Rename existing spotlight e2e test files from test_*_spotlight to test_*_object for consistency, and add query-specific e2e tests under tests/e2e/spotlight/query/. Update unit tests to cover the new queries resource and extend the existing spotlight unit suite.
📝 WalkthroughWalkthroughThis pull request introduces a new Spotlight "queries" resource layer to the MPT API Python client. It adds a Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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/spotlight/query/test_sync_query.py (1)
34-36: Strengthen filter test by asserting the returned query ID.At Line 36, asserting only
len(result) == 1is weak; add an identity assertion to verify the filter actually matched the requested query.Suggested improvement
result = list(filtered_spotlight_queries.iterate()) assert len(result) == 1 + assert result[0].id == spotlight_query_id🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/spotlight/query/test_sync_query.py` around lines 34 - 36, The test currently only checks the count of results from filtered_spotlight_queries.iterate(); strengthen it by also asserting the identity of the returned query: after collecting result = list(filtered_spotlight_queries.iterate()), add an assertion that the single returned item's id equals the expected query id (e.g. assert result[0].id == expected_query.id or assert result[0]["id"] == expected_query_id depending on how query objects are represented) to ensure the filter matched the intended query.tests/e2e/spotlight/query/test_async_query.py (1)
34-36: Add ID assertion to harden async filter validation.At Line 36,
len(result) == 1does not prove the filter matched the expected query; assert the returned ID as well.Suggested improvement
result = [query async for query in filtered_spotlight_queries.iterate()] assert len(result) == 1 + assert result[0].id == spotlight_query_id🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/e2e/spotlight/query/test_async_query.py` around lines 34 - 36, The test currently only checks len(result) == 1 after calling filtered_spotlight_queries.iterate(), but doesn't verify the matched record; update the assertion to also check the returned query's ID (e.g., assert result[0].id == expected_query.id or assert result[0]["id"] == expected_id) so the async filter actually returned the expected query; use the same expected identifier set up earlier in the test (expected_query or expected_id) and reference result[0] from the list produced by filtered_spotlight_queries.iterate().
🤖 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/spotlight/query/test_async_query.py`:
- Around line 34-36: The test currently only checks len(result) == 1 after
calling filtered_spotlight_queries.iterate(), but doesn't verify the matched
record; update the assertion to also check the returned query's ID (e.g., assert
result[0].id == expected_query.id or assert result[0]["id"] == expected_id) so
the async filter actually returned the expected query; use the same expected
identifier set up earlier in the test (expected_query or expected_id) and
reference result[0] from the list produced by
filtered_spotlight_queries.iterate().
In `@tests/e2e/spotlight/query/test_sync_query.py`:
- Around line 34-36: The test currently only checks the count of results from
filtered_spotlight_queries.iterate(); strengthen it by also asserting the
identity of the returned query: after collecting result =
list(filtered_spotlight_queries.iterate()), add an assertion that the single
returned item's id equals the expected query id (e.g. assert result[0].id ==
expected_query.id or assert result[0]["id"] == expected_query_id depending on
how query objects are represented) to ensure the filter matched the intended
query.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro
Run ID: d063f1fb-25be-40cc-a9d9-769fc1d5508e
📒 Files selected for processing (10)
e2e_config.test.jsonmpt_api_client/resources/spotlight/queries.pympt_api_client/resources/spotlight/spotlight.pytests/e2e/spotlight/query/conftest.pytests/e2e/spotlight/query/test_async_query.pytests/e2e/spotlight/query/test_sync_query.pytests/e2e/spotlight/test_async_object.pytests/e2e/spotlight/test_sync_object.pytests/unit/resources/spotlight/test_queries.pytests/unit/resources/spotlight/test_spotlight.py



🤖 AI-generated PR — Please review carefully.
What changed
mpt_api_client/resources/spotlight/queries.pywith a dedicated queries resource module covering sync and async endpoint operations.mpt_api_client/resources/spotlight/spotlight.pyto expose the new queries resource.tests/e2e/spotlight/query/(sync and async).test_async_spotlight.py→test_async_object.pyandtest_sync_spotlight.py→test_sync_object.pyfor naming consistency with the object-level scope.tests/unit/resources/spotlight/test_queries.py.tests/unit/resources/spotlight/test_spotlight.pyto cover the new surface.e2e_config.test.jsonwith required query test configuration.Closes MPT-20430
SpotlightQuerymodel and query service classes (SpotlightQueriesServiceandAsyncSpotlightQueriesService) for the/public/v1/spotlight/queriesendpoint with support for get-by-id and collection retrieval operationsSpotlightandAsyncSpotlightmodules via.queriesproperties