def test_create(self, *args): set_module_args( dict(name='fake_policy', file='foobar.xml', dest='/tmp/foobar.xml', provider=dict(server='localhost', password='******', user='******'))) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, mutually_exclusive=self.spec.mutually_exclusive, ) mp = ModuleParameters(params=module.params) mp._policy_exists = Mock(return_value=True) mm = ModuleManager(module=module) mm.want = Mock(return_value=mp) mm.want.binary = False mm.exists = Mock(return_value=False) mm.create_on_device = Mock(return_value=True) mm.execute = Mock(return_value=True) results = mm.exec_module() assert results['changed'] is True
def test_module_parameters(self): args = dict(inline='yes', compact='no', base64='yes', dest='/tmp/foo.xml', force='yes', file='foo.xml') p = ModuleParameters(params=args) assert p.inline is True assert p.compact is False assert p.base64 is True assert p.file == 'foo.xml'
def test_module_parameters(self): args = dict(inline='yes', compact='no', base64='yes', dest='/tmp/foo.xml', force='yes', file='foo.xml', password='******', server='localhost', user='******') p = ModuleParameters(params=args) assert p.inline is True assert p.compact is False assert p.base64 is True assert p.file == 'foo.xml'