[CLI] Add archive/unarchive commands for test run execution - #122
Conversation
Add `test-run-execution archive` and `test-run-execution unarchive`
commands, calling the backend's existing
POST /test_run_executions/{id}/archive and .../unarchive endpoints,
which previously had no CLI equivalent.
Closes project-chip/certification-tool#1120
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Tick the box to add this pull request to the merge queue (same as
|
The archive/unarchive commands added a way to change the archived state of a test run execution, but there was no way to list which executions are currently archived. The backend's GET /test_run_executions/ endpoint already supports an 'archived' query parameter, so this just threads it through the CLI. - Add --archived flag to 'test-run-execution' list options - Reject --archived combined with --id (mirrors --all/--log rules) - Show 'Archived: yes' in the filter info line when active - Add/update unit tests covering the new flag and fix existing assertions broken by the new archived=False default kwarg
UnexpectedResponse.__init__() only accepts status_code and content, but the fixture passed an unsupported headers= kwarg, causing every test that depends on it to error out with a TypeError instead of running (e.g. test_repeat_stops_two_way_talk_handler_on_start_failure). Drop the unsupported kwarg and the now-unused httpx.Headers import.
Summary
Adds
test-run-execution archiveandtest-run-execution unarchivecommands to the CLI, plus a--archivedfilter ontest-run-executionlist output.The backend has exposed
POST /api/v1/test_run_executions/{id}/archive,POST /api/v1/test_run_executions/{id}/unarchive, and anarchivedquery parameter onGET /api/v1/test_run_executions/for a while, but the CLI had no way to call any of them.Closes #1120
Changes
th_cli/commands/test_run_execution.py:archiveandunarchivesubcommands under thetest-run-executiongroup, following the same--id/confirmation-free pattern as the existingdelete/renamecommands.--archivedflag on the list command, threaded through to the backend's existingarchivedquery parameter. Rejected in combination with--id(mirrors the existing--all/--logvalidation). Shows "Archived: yes" in the filter info line when active.tests/test_test_run_execution_archive_unarchive.py: unit tests covering success, API error, missing--id, and--helpfor both commands.tests/test_test_run_execution.py: new tests for the--archivedflag (success, combined with--project-id, rejected with--id, shown in--help), plus fixes to existing mock assertions that didn't expect the newarchived=Falsedefault kwarg on the list API call.Test plan
pytest tests/test_test_run_execution_archive_unarchive.py -v— 8/8 passing.pytest tests/test_test_run_execution.py -v --no-cov— 64/64 passing.pytest tests/ -k test_run_execution --no-cov— no new failures (1 pre-existing unrelated fixture error intest_test_run_execution_repeat_export_import.py).black,isort,mypy— no new issues introduced by this change.