def test_module_parameters_memory_medium(self): args = dict( module='mgmt', memory='medium', ) p = ModuleParameters(params=args) assert p.memory == 200
def test_module_parameters_memory_large(self): args = dict( module='mgmt', memory='large', ) p = ModuleParameters(params=args) assert p.memory == 500
def test_provision_one_module_default_level(self, *args): # Configure the arguments that would be sent to the Ansible module set_module_args( dict(module='gtm', provider=dict(server='localhost', password='******', user='******'))) # Configure the parameters that would be returned by querying the # remote device current = ModuleParameters(dict(module='gtm', level='none')) module = AnsibleModule( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, ) mm = ModuleManager(module=module) # Override methods to force specific logic in the module to happen mm.update_on_device = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) mm.reboot_device = Mock(return_value=True) mm.save_on_device = Mock(return_value=True) # this forced sleeping can cause these tests to take 15 # or more seconds to run. This is deliberate. mm._is_mprov_running_on_device = Mock( side_effect=[True, False, False, False, False]) mm._is_rest_available = Mock( side_effect=[False, False, True, True, True]) results = mm.exec_module() assert results['changed'] is True assert results['level'] == 'nominal'
def test_module_parameters_memory_small(self): args = dict( module='mgmt', memory='small', ) p = ModuleParameters(params=args) assert p.memory == 0
def test_module_parameters_memory_700(self): args = dict( module='mgmt', memory=700, ) p = ModuleParameters(params=args) assert p.memory == 700
def test_module_parameters(self): args = dict( module='gtm', level='nominal', ) p = ModuleParameters(params=args) assert p.module == 'gtm' assert p.level == 'nominal'
def test_module_parameters_level_dedicated(self): args = dict(level='dedicated', ) p = ModuleParameters(params=args) assert p.level == 'dedicated'
def test_module_parameters_level_nominal(self): args = dict(level='nominal', ) p = ModuleParameters(params=args) assert p.level == 'nominal'
def test_module_parameters_level_minimum(self): args = dict(level='minimum', ) p = ModuleParameters(params=args) assert p.level == 'minimum'
def test_module_parameters_mod_urldb(self): args = dict(module='urldb', ) p = ModuleParameters(params=args) assert p.module == 'urldb'
def test_module_parameters_mod_sslo(self): args = dict(module='sslo', ) p = ModuleParameters(params=args) assert p.module == 'sslo'
def test_module_parameters_mod_mgmt(self): args = dict(module='mgmt', ) p = ModuleParameters(params=args) assert p.module == 'mgmt'
def test_module_parameters_mod_apm(self): args = dict(module='apm', ) p = ModuleParameters(params=args) assert p.module == 'apm'