mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 13:21:25 -07:00
Add more tests for method option change (#52228)
This commit is contained in:
parent
a65a137cdd
commit
668f014b3c
36 changed files with 186 additions and 23 deletions
|
@ -205,9 +205,9 @@ class TestInterfacesFileModule(unittest.TestCase):
|
|||
testcases = {
|
||||
"change_method": [
|
||||
{
|
||||
'iface': 'eth0',
|
||||
'iface': 'eth1',
|
||||
'option': 'method',
|
||||
'value': 'manual',
|
||||
'value': 'dhcp',
|
||||
'state': 'present',
|
||||
}
|
||||
],
|
||||
|
@ -223,7 +223,15 @@ class TestInterfacesFileModule(unittest.TestCase):
|
|||
options = options_list[0]
|
||||
fail_json_iterations = []
|
||||
try:
|
||||
_, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'], options['option'], options['value'], options['state'])
|
||||
changed, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'], options['option'],
|
||||
options['value'], options['state'])
|
||||
# When a changed is made try running it again for proper idempotency
|
||||
if changed:
|
||||
changed_again, lines = interfaces_file.setInterfaceOption(module, lines, options['iface'],
|
||||
options['option'], options['value'], options['state'])
|
||||
self.assertFalse(changed_again,
|
||||
msg='Second request for change should return false for {0} running on {1}'.format(testname,
|
||||
testfile))
|
||||
except AnsibleFailJson as e:
|
||||
fail_json_iterations.append("fail_json message: %s\noptions:\n%s" %
|
||||
(str(e), json.dumps(options, sort_keys=True, indent=4, separators=(',', ': '))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue