RedHatQE / pylero

Python wrapper for the Polarion WSDL API
https://redhatqe.github.io/pylero/
MIT License
38 stars 25 forks source link

AttributeError: 'TestRun' object has no attribute 'set_custom_field' #167

Closed vamahaja closed 8 months ago

vamahaja commented 9 months ago

set_custom_field method is missing from TestRun class. Refer below code -

from pylero.test_run import TestRun

project="test"
test_run_id="testrun"
template="test"
status="inprogress"

tr = TestRun.create(project_id=project, test_run_id=test_run_id, template=template)

tr.status = status

arch = tr.get_custom_field("arch")
print(f"arch :: {arch}")
print(f"arch.key :: {arch.key}")
print(f"arch.value :: {arch.value}")

tr.set_custom_field("arch", "i386")

tr.update()

Getting below error -

arch :: <pylero.custom.Custom object at 0x7f7195b629e0>
arch.key :: arch
arch.value :: None
Traceback (most recent call last):
  File "/home/vamahaja/Codes/debug/pylero-01.py", line 17, in <module>
    tr.set_custom_field("arch", "i386")
AttributeError: 'TestRun' object has no attribute 'set_custom_field'. Did you mean: '_set_custom_field'?
vamahaja commented 9 months ago

Below code is working -

from pylero.test_run import TestRun

project="test"
test_run_id="testrun"
template="test"
status="inprogress"

tr = TestRun.create(project_id=project, test_run_id=test_run_id, template=template)

tr.status = status
tr.arch = "i386"

arch = tr.get_custom_field("arch")
print(f"arch :: {arch}")

tr.update()
waynesun09 commented 8 months ago

Mark resolve as it works with directly setting custom field with update attribute value