mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-23 17:39:09 -07:00
-Fixes JSON parsing(use JSON object instead of string) for facts modules. (#31818)
This commit is contained in:
parent
2765ee4b9a
commit
465fe5802b
4 changed files with 204 additions and 3 deletions
|
@ -88,6 +88,17 @@ class TestJunosCommandModule(TestJunosModule):
|
|||
self.assertEqual(facts['ansible_net_hostname'], 'vsrx01')
|
||||
self.assertTrue('ansible_net_interfaces' not in facts)
|
||||
|
||||
def test_junos_get_facts_subset_config_json(self):
|
||||
self.get_config.return_value = load_fixture('get_configuration_rpc_reply_json.txt')
|
||||
set_module_args(dict(gather_subset='config', config_format='json'))
|
||||
result = self.execute_module(format='xml')
|
||||
facts = result['ansible_facts']
|
||||
|
||||
self.assertTrue('ansible_net_config' in facts)
|
||||
self.assertTrue('configuration' in facts['ansible_net_config'])
|
||||
self.assertEqual(facts['ansible_net_hostname'], 'vsrx01')
|
||||
self.assertTrue('ansible_net_interfaces' not in facts)
|
||||
|
||||
def test_junos_get_facts_subset_list(self):
|
||||
set_module_args(dict(gather_subset=['hardware', 'interfaces']))
|
||||
result = self.execute_module(format='xml')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue