def test_create(self, *args): set_module_args( dict(name='fake_policy', file='foo_export', dest='/tmp/', provider=dict(server='localhost', password='******', user='******'))) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, ) mp = ModuleParameters(params=module.params) mp._item_exists = Mock(return_value=True) mm = ModuleManager(module=module) mm.version_less_than_14 = Mock(return_value=False) mm.want = Mock(return_value=mp) 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(dest='/tmp/', force='yes', file='foo_export', provider=dict(server='localhost', password='******', user='******')) p = ModuleParameters(params=args) assert p.file == 'foo_export'