def test_ensure_feature_is_enabled_called(self): set_module_args(dict( nitro_user='******', nitro_pass='******', nsip='192.0.2.1', state='present', save_config=False, )) from ansible.modules.network.netscaler import netscaler_lb_monitor client_mock = Mock() lb_monitor_proxy_mock = Mock(diff_object=Mock(return_value={})) feature_mock = Mock() with patch.multiple( 'ansible.modules.network.netscaler.netscaler_lb_monitor', get_nitro_client=Mock(return_value=client_mock), lbmonitor_exists=Mock(side_effect=[True, True]), lbmonitor_identical=Mock(side_effect=[True, True]), ConfigProxy=Mock(return_value=lb_monitor_proxy_mock), ensure_feature_is_enabled=feature_mock, ): self.module = netscaler_lb_monitor self.exited() feature_mock.assert_called_with(client_mock, 'LB')
def test_ensure_feature_is_enabled_called(self): set_module_args( dict( nitro_user='******', nitro_pass='******', nsip='192.0.2.1', state='present', )) from ansible.modules.network.netscaler import netscaler_gslb_vserver gslb_service_proxy_mock = Mock() ensure_feature_is_enabled_mock = Mock() client_mock = Mock() with patch.multiple( 'ansible.modules.network.netscaler.netscaler_gslb_vserver', get_nitro_client=Mock(return_value=client_mock), gslb_vserver_exists=Mock(side_effect=[False, True]), gslb_vserver_identical=Mock(side_effect=[True]), nitro_exception=self.MockException, ensure_feature_is_enabled=ensure_feature_is_enabled_mock, do_state_change=Mock(return_value=Mock(errorcode=0)), ConfigProxy=Mock(return_value=gslb_service_proxy_mock), ): self.module = netscaler_gslb_vserver self.exited() ensure_feature_is_enabled_mock.assert_called_with( client_mock, 'GSLB')