RedHatQE / pylero

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

[bug] the TestRun class presumes possible values of the member status #168

Closed AlthausKonstantin closed 8 months ago

AlthausKonstantin commented 9 months ago

Dear all,

I stumbled on the following bug. The function _status_change changes the field status of the class TestRun to values that are possibly not allowed. As status is an instance of the class EnumOptionId, its possible values are determined at run time with options that come from the current Polarion project. Example

tr = TestRun(...) # get valid test run of my project
valid_fields = tr.get_valid_field_values(tr._cls_suds_map['status']["enum_id"], None)
# valid_fields is [open, passed, failed]

With the example in mind, the logic of _status_changedoes not make sense. Therefore, I propose to rewrite the test_run module such that it is agnostic of the possible values of status. I fear, on the other hand, that this removes functionality others might rely on. At least we could skip the relevant parts of the code if they do not match the status enumeration currently presumed. What do you think about this?

Best, Konstantin

leelavg commented 9 months ago

to values that are possibly not allowed.

  • there's a possibility that the allowed values against the server we are running are inprogress, not run, finished and so we are skipping explicit enum check.
  • If that's not the case I believe the assignment might fail as the value may not be valid enum
  • Nevertheless, I believe your concern is valid, we can get values and decide on setting or skipping it during runtime.
AlthausKonstantin commented 9 months ago

Thanks for the feedback. I will open a PR to fix this :)