def test_update_monitors(self, *args): set_module_args( dict(name='test_pool', partition='Common', monitor_type='and_list', monitors=['/Common/http', '/Common/tcp'], server='localhost', password='******', user='******')) client = AnsibleF5Client( argument_spec=self.spec.argument_spec, supports_check_mode=self.spec.supports_check_mode, f5_product_name=self.spec.f5_product_name) mm = ModuleManager(client) current = ApiParameters(load_fixture('load_ltm_pool.json')) mm.update_on_device = Mock(return_value=True) mm.exists = Mock(return_value=True) mm.read_current_from_device = Mock(return_value=current) results = mm.exec_module() assert results['changed'] is True assert results['monitor_type'] == 'and_list'
def test_api_parameters(self): args = dict(monitor="/Common/Fake and /Common/Fake2 ", slowRampTime=200, reselectTries=5, serviceDownAction='drop') p = ApiParameters(args) assert p.monitors == '/Common/Fake and /Common/Fake2' assert p.slow_ramp_time == 200 assert p.reselect_tries == 5 assert p.service_down_action == 'drop'
def test_unknown_api_lb_method(self): args = dict(loadBalancingMode='obscure_hypenated_fake_method') with pytest.raises(F5ModuleError): p = ApiParameters(args) assert p.lb_method == 'foo'