Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix move_cases_to_section #84

Merged
merged 1 commit into from
Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions testrail_api/_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,18 +492,25 @@ def copy_cases_to_section(self, section_id: int, case_ids: List[int]):
json={"case_ids": ",".join(map(str, case_ids))},
)

def move_cases_to_section(self, section_or_suite_id: int, case_ids: List[str]):
def move_cases_to_section(
self, section_id: int, suite_id: int, case_ids: List[str]
):
"""
Moves cases to another suite or section.

:param section_or_suite_id: int
The ID of the section or suite the case will be moved to.
:param section_id: int
The ID of the section the cases will be moved to.
:param suite_id: int
The ID of the suite for the section the cases will be moved to.
:param case_ids:
List of case IDs.
"""
return self.s.post(
endpoint=f"move_cases_to_section/{section_or_suite_id}",
json={"case_ids": ",".join(map(str, case_ids))},
endpoint=f"move_cases_to_section/{section_id}",
json={
"case_ids": ",".join(map(str, case_ids)),
"suite_id": suite_id,
},
)


Expand Down
3 changes: 2 additions & 1 deletion tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,5 +193,6 @@ def test_move_cases_to_section(api, mock, url):
mock.add_callback(
responses.POST, url("move_cases_to_section/5"), lambda x: (200, {}, x.body)
)
resp = api.cases.move_cases_to_section(section_or_suite_id=5, case_ids=[1, 2, 3])
resp = api.cases.move_cases_to_section(5, 6, case_ids=[1, 2, 3])
assert resp["case_ids"] == "1,2,3"
assert resp["suite_id"] == 6