@@ -160,6 +160,21 @@ def get_test_case(self, case_id):
160
160
"""Get a given Test Case"""
161
161
return self .client .send_get (f"get_case/{ case_id } " )
162
162
163
+ def update_cases_in_suite (self , suite_id , case_ids , ** kwargs ):
164
+ """Given a suite and a list of test cases, update all listed
165
+ test cases according to keyword args"""
166
+ if not kwargs :
167
+ return None
168
+ return self .client .send_post (
169
+ f"update_cases/{ suite_id } " , {"case_ids" : case_ids , ** kwargs }
170
+ )
171
+
172
+ def update_test_case (self , case_id , ** kwargs ):
173
+ """Given a test case id, update according to keyword args"""
174
+ if not kwargs :
175
+ return None
176
+ return self .client .send_post (f"update_case/{ case_id } " , ** kwargs )
177
+
163
178
def create_test_run_on_plan_entry (
164
179
self , plan_id , entry_id , config_ids , description = None , case_ids = None
165
180
):
@@ -235,6 +250,14 @@ def matching_plan_in_milestone(self, testrail_project_id, milestone_id, plan_nam
235
250
return self ._get_full_plan (plan .get ("id" ))
236
251
return None
237
252
253
+ def matching_custom_field (self , name ):
254
+ """Given a name, return the case_field object that matches (name or label)"""
255
+ custom_fields = self ._get_case_fields ()
256
+ for field in custom_fields :
257
+ if name in field .get ("name" ) or name in field .get ("label" ):
258
+ return field
259
+ return None
260
+
238
261
def create_new_plan (
239
262
self ,
240
263
testrail_project_id ,
@@ -448,6 +471,9 @@ def _get_plans_in_milestone(self, testrail_project_id, milestone_id):
448
471
def _get_full_plan (self , plan_id ):
449
472
return self .client .send_get (f"get_plan/{ plan_id } " )
450
473
474
+ def _get_case_fields (self ):
475
+ return self .client .send_get ("get_case_fields" )
476
+
451
477
def _retry_api_call (self , api_call , * args , max_retries = 3 , delay = 5 ):
452
478
"""
453
479
Retries the given API call up to max_retries times with a delay between attempts.
0 commit comments