RedHatQE / pong

Other
3 stars 1 forks source link

Getting a failure when creating a TestRun with error that plannedin is a required field #24

Open rarebreed opened 8 years ago

rarebreed commented 8 years ago

Here, I am getting the Template TestRun to show that the plannedin field exists for the Template. However, when I try to create a TestRun based off of it, the create call fails

>>> TEMP_ID
'RHSM RHEL\\-7 3'
>>> templates = TestRun.search(TEMP_ID, fields=["test_run_id", "created", "status"], sort="created", search_templates=True)
>>> templates
[<pylarion.test_run.TestRun object at 0x7fc3a78c4290>]
>>> template = templates[0]
>>> template = TestRun(uri=template.uri)
>>> template.plannedin
RHEL_7_3
>>> template.test_run_id
RHSM RHEL-7 3
>>> NEW_ID = "RHSM example run"
>>> PROJECT_ID = "RedHatEnterpriseLinux7"
>>> new_tr = TestRun.create(PROJECT_ID, NEW_ID, TEMP_ID)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<decorator-gen-158>", line 2, in create
  File "/home/stoner/venvs/pong/lib/python2.7/site-packages/pylarion/logstasher.py", line 134, in wrapper
    res = func(*args, **kwargs)
  File "/home/stoner/venvs/pong/lib/python2.7/site-packages/pylarion/test_run.py", line 195, in create
    tr.verify_required(**kwargs)
  File "<decorator-gen-169>", line 2, in verify_required
  File "/home/stoner/venvs/pong/lib/python2.7/site-packages/pylarion/logstasher.py", line 104, in wrapper
    return func(*args, **kwargs)
  File "/home/stoner/venvs/pong/lib/python2.7/site-packages/pylarion/test_run.py", line 1112, in verify_required
    format(fields))
PylarionLibException: These parameters are required: plannedin

However, I can workaround this problem by manually setting the plannedin field like this

>>> plannedin = template.plannedin
>>> plannedin
RHEL_7_3
>>> new_tr = TestRun.create(PROJECT_ID, NEW_ID, TEMP_ID, plannedin=plannedin)
>>> new_tr.test_run_id
RHSM example run
>>> new_tr.plannedin
RHEL_7_3