def test_update(self, *args):
        set_module_args(dict(
            enforced_policy='enforced1',
            staged_policy='staged1',
            service_policy='service1',
            provider=dict(
                server='localhost',
                password='******',
                user='******'
            )
        ))

        module = AnsibleModule(
            argument_spec=self.spec.argument_spec,
            supports_check_mode=self.spec.supports_check_mode
        )

        current = ApiParameters(params=load_fixture('load_security_firewall_global_rules_1.json'))

        # Override methods to force specific logic in the module to happen
        mm = ModuleManager(module=module)
        mm.update_on_device = Mock(return_value=True)
        mm.read_current_from_device = Mock(return_value=current)

        results = mm.exec_module()

        assert results['changed'] is True
Esempio n. 2
0
 def test_api_parameters(self):
     p = ApiParameters(
         params=load_fixture('load_security_firewall_global_rules_1.json'))
     assert p.enforced_policy == '/Common/foo'
     assert p.service_policy == '/Common/bar'
     assert p.staged_policy == '/Common/baz'