feat: add read commands for plans, suites, and cases (#401)#402
Draft
cosmicdreams wants to merge 1 commit intogurock:mainfrom
Draft
feat: add read commands for plans, suites, and cases (#401)#402cosmicdreams wants to merge 1 commit intogurock:mainfrom
cosmicdreams wants to merge 1 commit intogurock:mainfrom
Conversation
Collaborator
|
Hi @cosmicdreams, thank you for submitting this PR. Once ready, can you point this to release/1.13.4 instead of main? We'll be reviewing the changes before we can merge. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being resolved: #401
Solution description
Added five read commands that fetch TestRail data as JSON to stdout, using the
existing
cmd_*.pyauto-discovery pattern.get_plansandget_planareexposed as public methods on
ApiRequestHandlerwith caching (matching theexisting
get_suitespattern).get_suites,get_cases, andget_casecallAPIClient.send_getdirectly. All commands honour global auth flags and env vars.Changes
trcli/api/api_request_handler.py— newget_plans(project_id)andget_plan(plan_id)public methods + private__get_all_planswith cachingtrcli/commands/cmd_get_plans.py— list all plans for a projecttrcli/commands/cmd_get_plan.py— fetch a single plan by IDtrcli/commands/cmd_get_suites.py— list all suites for a projecttrcli/commands/cmd_get_cases.py— list cases with pagination + optional --section-id filtertrcli/commands/cmd_get_case.py— fetch a single case by IDtests/test_cmd_get_*.py— 30 new CLI tests (happy path, error path, missing args)tests/test_api_request_handler.py— 4 new handler unit testsREADME.md— new "Reading data from TestRail" section with usage table and examplesCHANGELOG.MD— [Unreleased] entryPotential impacts
cli.py— new files only, plus additivechanges to
api_request_handler.pytrcli --helpautomatically via folder scanget_plansuses the same_cachemechanism asget_suites—no new cache behaviour introduced
Steps to test
trcli -h <host> -u <user> -k <key> get_plans --project-id 1→ JSON array of planstrcli -h <host> -u <user> -k <key> get_plan --plan-id 42→ JSON plan objecttrcli -h <host> -u <user> -k <key> get_suites --project-id 1→ JSON array of suitestrcli -h <host> -u <user> -k <key> get_cases --project-id 1 --suite-id 3→ JSON array of casestrcli -h <host> -u <user> -k <key> get_cases --project-id 1 --suite-id 3 --section-id 10→ filteredcases
trcli -h <host> -u <user> -k <key> get_case --case-id 5001→ JSON case objectpython3 -m pytest -c ./tests/pytest.ini -W ignore::pytest.PytestCollectionWarning tests/test_cmd_get_*.py tests/test_api_request_handler.py→ all passPR Tasks