def test_create_monitor(self, *args): set_module_args(dict( name='foo', gateway='1.1.1.1', network='default', description='my description', partition='Common', server='localhost', password='******', user='******' )) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode ) # Override methods in the specific type of manager mm = ModuleManager(module=module) mm.exists = Mock(side_effect=[False, True]) mm.create_on_device = Mock(return_value=True) results = mm.exec_module() assert results['changed'] is True assert results['gateway'] == '1.1.1.1' assert results['network'] == 'default' assert results['description'] == 'my description'