@@ -207,7 +207,7 @@ def start_launch(self,
207
207
mode = None ,
208
208
** kwargs ):
209
209
"""Start a new launch with the given parameters."""
210
- if attributes is not None :
210
+ if attributes and isinstance ( attributes , dict ) :
211
211
attributes = _dict_to_payload (attributes )
212
212
data = {
213
213
"name" : name ,
@@ -262,7 +262,7 @@ def start_test_item(self,
262
262
...
263
263
}
264
264
"""
265
- if attributes :
265
+ if attributes and isinstance ( attributes , dict ) :
266
266
attributes = _dict_to_payload (attributes )
267
267
if parameters :
268
268
parameters = _dict_to_payload (parameters )
@@ -287,6 +287,24 @@ def start_test_item(self,
287
287
logger .debug ("start_test_item - ID: %s" , item_id )
288
288
return item_id
289
289
290
+ def update_test_item (self , item_uuid , attributes = None , description = None ):
291
+ """Update existing test item at the Report Portal.
292
+
293
+ :param str item_uuid: Test item UUID returned on the item start
294
+ :param str description: Test item description
295
+ :param list attributes: Test item attributes
296
+ [{'key': 'k_name', 'value': 'k_value'}, ...]
297
+ """
298
+ data = {
299
+ "description" : description ,
300
+ "attributes" : attributes ,
301
+ }
302
+ item_id = self .get_item_id_by_uuid (item_uuid )
303
+ url = uri_join (self .base_url_v1 , "item" , item_id , "update" )
304
+ r = self .session .put (url = url , json = data , verify = self .verify_ssl )
305
+ logger .debug ("update_test_item - Item: %s" , item_id )
306
+ return _get_msg (r )
307
+
290
308
def finish_test_item (self ,
291
309
item_id ,
292
310
end_time ,
@@ -310,7 +328,7 @@ def finish_test_item(self,
310
328
and not self .is_skipped_an_issue :
311
329
issue = {"issue_type" : "NOT_ISSUE" }
312
330
313
- if attributes :
331
+ if attributes and isinstance ( attributes , dict ) :
314
332
attributes = _dict_to_payload (attributes )
315
333
316
334
data = {
@@ -325,6 +343,16 @@ def finish_test_item(self,
325
343
logger .debug ("finish_test_item - ID: %s" , item_id )
326
344
return _get_msg (r )
327
345
346
+ def get_item_id_by_uuid (self , uuid ):
347
+ """Get test item ID by the given UUID.
348
+
349
+ :param str uuid: UUID returned on the item start
350
+ :return str: Test item id
351
+ """
352
+ url = uri_join (self .base_url_v1 , "item" , "uuid" , uuid )
353
+ return _get_json (self .session .get (
354
+ url = url , verify = self .verify_ssl ))["id" ]
355
+
328
356
def get_project_settings (self ):
329
357
"""
330
358
Get settings from project.
0 commit comments