@@ -20,12 +20,14 @@ def approve_tests(polarion_project_id: str, added_ids: List[str]) -> Dict[str, L
2020 )
2121
2222
23- def remove_approved_tests (polarion_project_id : str , added_ids : Optional [List [str ]] = None ) -> Dict [str , List [str ]]:
23+ def remove_approved_tests (
24+ polarion_project_id : str , branch : str , added_ids : Optional [List [str ]] = None
25+ ) -> Dict [str , List [str ]]:
2426 removed_polarions = {}
2527 added_ids = added_ids or []
26- if removed_ids := set (find_polarion_ids ( polarion_project_id = polarion_project_id , string_to_match = "removed" )) - set (
27- added_ids
28- ):
28+ if removed_ids := set (
29+ find_polarion_ids ( polarion_project_id = polarion_project_id , string_to_match = "removed" , branch = branch )
30+ ) - set ( added_ids ) :
2931 LOGGER .info (f"Following polarion ids were removed: { removed_ids } " )
3032 removed_polarions = update_polarion_ids (
3133 polarion_ids = list (removed_ids ), project_id = polarion_project_id , is_automated = False
@@ -42,8 +44,9 @@ def remove_approved_tests(polarion_project_id: str, added_ids: Optional[List[str
4244 default = os .path .expanduser ("~/.config/python-utility-scripts/config.yaml" ),
4345)
4446@click .option ("--project-id" , "-p" , help = "Provide the polarion project id" )
47+ @click .option ("--branch" , "-b" , help = "Provide the github remote branch to run against" , default = "origin/main" )
4548@click .option ("--verbose" , default = False , is_flag = True )
46- def polarion_approve_automate (config_file_path : str , project_id : str , verbose : bool ) -> None :
49+ def polarion_approve_automate (config_file_path : str , project_id : str , branch : str , verbose : bool ) -> None :
4750 if verbose :
4851 LOGGER .setLevel (logging .INFO )
4952 else :
@@ -52,11 +55,13 @@ def polarion_approve_automate(config_file_path: str, project_id: str, verbose: b
5255 config_file_path = config_file_path , util_name = "pyutils-polarion-set-automated"
5356 )
5457 added_polarions = {}
55- if added_ids := find_polarion_ids (polarion_project_id = polarion_project_id , string_to_match = "added" ):
58+ if added_ids := find_polarion_ids (polarion_project_id = polarion_project_id , string_to_match = "added" , branch = branch ):
5659 added_polarions = approve_tests (polarion_project_id = polarion_project_id , added_ids = added_ids )
5760 LOGGER .info (f"Following polarion ids were marked automated and approved: { added_polarions .get ('updated' )} " )
5861
59- removed_polarions = remove_approved_tests (polarion_project_id = polarion_project_id , added_ids = added_ids )
62+ removed_polarions = remove_approved_tests (
63+ polarion_project_id = polarion_project_id , added_ids = added_ids , branch = branch
64+ )
6065 if removed_polarions .get ("failed" ) or added_polarions .get ("failed" ):
6166 error = "Following polarion ids updates failed."
6267 if removed_polarions .get ("failed" ):
0 commit comments