-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix in hosts param crud test #15596
fix in hosts param crud test #15596
Conversation
trigger: test-robottelo |
PRT Result
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we are changing the older way of assertion? what is return value of host['parameters']
?
I would assert with exact name
& value
rather asserting with list type object.
assert name == host['parameters']['name']
assert value == host['parameters']['value']
tests/foreman/cli/test_host.py
Outdated
assert name in [param["name"] for param in host['parameters']] | ||
assert value in [param["value"] for param in host['parameters']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are going to continue with these new changes then I would suggest to use single quote for string to maintain consistant pattern
assert name in [param["name"] for param in host['parameters']] | |
assert value in [param["value"] for param in host['parameters']] | |
assert name in [param['name'] for param in host['parameters']] | |
assert value in [param['value'] for param in host['parameters']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we merge these assertions like "(name,value) in [(param['name'], param['value']) for param in host['parameters']]"
tests/foreman/cli/test_host.py
Outdated
assert name in [param["name"] for param in host['parameters']] | ||
assert new_value in [param["value"] for param in host['parameters']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert name in [param["name"] for param in host['parameters']] | |
assert new_value in [param["value"] for param in host['parameters']] | |
assert name in [param['name'] for param in host['parameters']] | |
assert new_value in [param['value'] for param in host['parameters']] |
tests/foreman/cli/test_host.py
Outdated
|
||
target_sat.cli.Host.delete_parameter({'host-id': host['id'], 'name': name}) | ||
host = target_sat.cli.Host.info({'id': host['id']}) | ||
assert name not in host['parameters'] | ||
assert name not in [param["name"] for param in host['parameters']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert name not in [param["name"] for param in host['parameters']] | |
assert name not in [param['name'] for param in host['parameters']] |
tests/foreman/cli/test_host.py
Outdated
assert name in [param["name"] for param in host['parameters']] | ||
assert value in [param["value"] for param in host['parameters']] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we merge these assertions like "(name,value) in [(param['name'], param['value']) for param in host['parameters']]"
13ab64f
to
b280065
Compare
trigger: test-robottelo |
host['parameters'] is a list of dictionaries, something like [{name: 'a', value:'b'}] |
PRT Result
|
we can do something like this, can you please check and update?
This can be done in other better way |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for work @pondrejk
Ack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
I think that would only work with a single parameter assigned to a host, since we use function host I suppose there could be more params |
Problem Statement
assertion error
Solution
reacting to change in param object