コード例 #1
0
    def test_absent_operation_no_change(self):
        self.set_module_state('absent')
        from ansible_collections.community.general.plugins.modules.network.netscaler import netscaler_service
        service_proxy_mock = MagicMock()
        attrs = {
            'diff_object.return_value': {},
        }
        service_proxy_mock.configure_mock(**attrs)

        m = MagicMock(return_value=service_proxy_mock)
        service_exists_mock = Mock(side_effect=[False, False])

        with patch.multiple(
                'ansible_collections.community.general.plugins.modules.network.netscaler.netscaler_service',
                ConfigProxy=m,
                service_exists=service_exists_mock,
        ):
            self.module = netscaler_service
            result = self.exited()
            service_proxy_mock.assert_not_called()
            self.assertFalse(result['changed'],
                             msg='Changed status not set correctly')
コード例 #2
0
    def test_absent_operation_no_change(self):
        self.set_module_state('absent')
        from ansible_collections.community.general.plugins.modules.network.netscaler import netscaler_cs_policy
        cs_policy_mock = MagicMock()
        attrs = {
            'diff_object.return_value': {},
        }
        cs_policy_mock.configure_mock(**attrs)

        m = MagicMock(return_value=cs_policy_mock)
        policy_exists_mock = Mock(side_effect=[False, False])

        with patch.multiple(
                'ansible_collections.community.general.plugins.modules.network.netscaler.netscaler_cs_policy',
                ConfigProxy=m,
                policy_exists=policy_exists_mock,
                nitro_exception=self.MockException,
                ensure_feature_is_enabled=Mock(),
        ):
            self.module = netscaler_cs_policy
            result = self.exited()
            cs_policy_mock.assert_not_called()
            self.assertFalse(result['changed'],
                             msg='Changed status not set correctly')