本文整理汇总了Python中ansible.compat.tests.mock.Mock.assert_not_called方法的典型用法代码示例。如果您正苦于以下问题:Python Mock.assert_not_called方法的具体用法?Python Mock.assert_not_called怎么用?Python Mock.assert_not_called使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ansible.compat.tests.mock.Mock
的用法示例。
在下文中一共展示了Mock.assert_not_called方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_absent_gslb_site_noop_flow
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import assert_not_called [as 别名]
def test_absent_gslb_site_noop_flow(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='absent',
))
from ansible.modules.network.netscaler import netscaler_gslb_site
client_mock = Mock()
m = Mock(return_value=client_mock)
glsb_site_proxy_attrs = {
'diff_object.return_value': {},
}
gslb_site_proxy_mock = Mock()
gslb_site_proxy_mock.configure_mock(**glsb_site_proxy_attrs)
config_proxy_mock = Mock(return_value=gslb_site_proxy_mock)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_gslb_site',
get_nitro_client=m,
diff_list=Mock(return_value={}),
get_immutables_intersection=Mock(return_value=[]),
gslb_site_exists=Mock(side_effect=[False, False]),
gslb_site_identical=Mock(side_effect=[False, False]),
nitro_exception=self.MockException,
ensure_feature_is_enabled=Mock(),
ConfigProxy=config_proxy_mock,
):
self.module = netscaler_gslb_site
self.exited()
gslb_site_proxy_mock.assert_not_called()
示例2: test_ssl_bindings_not_called_for_non_ssl_service
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import assert_not_called [as 别名]
def test_ssl_bindings_not_called_for_non_ssl_service(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
save_config=False,
servicetype='HTTP',
))
from ansible.modules.network.netscaler import netscaler_lb_vserver
lb_vserver_proxy_mock = Mock()
ssl_sync_mock = Mock()
client_mock = Mock()
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_lb_vserver',
get_nitro_client=Mock(return_value=client_mock),
lb_vserver_exists=Mock(side_effect=[True, True]),
lb_vserver_identical=Mock(side_effect=[False, True]),
servicegroup_bindings_identical=Mock(side_effect=[True, True]),
service_bindings_identical=Mock(side_effect=[True, True]),
ssl_certkey_bindings_identical=Mock(side_effect=[False, True]),
ssl_certkey_bindings_sync=ssl_sync_mock,
ConfigProxy=Mock(return_value=lb_vserver_proxy_mock),
ensure_feature_is_enabled=Mock(return_value=True),
do_state_change=Mock(return_value=Mock(errorcode=0)),
get_immutables_intersection=(Mock(return_value=[])),
):
self.module = netscaler_lb_vserver
result = self.exited()
ssl_sync_mock.assert_not_called()
self.assertTrue(result['changed'])
示例3: test_absent_server_noop_flow
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import assert_not_called [as 别名]
def test_absent_server_noop_flow(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='absent',
))
from ansible.modules.network.netscaler import netscaler_ssl_certkey
client_mock = Mock()
m = Mock(return_value=client_mock)
ssl_certkey_proxy_attrs = {
'diff_object.return_value': {},
}
ssl_certkey_proxy_mock = Mock()
ssl_certkey_proxy_mock.configure_mock(**ssl_certkey_proxy_attrs)
config_proxy_mock = Mock(return_value=ssl_certkey_proxy_mock)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_ssl_certkey',
get_nitro_client=m,
diff_list=Mock(return_value={}),
get_immutables_intersection=Mock(return_value=[]),
key_exists=Mock(side_effect=[False, False]),
key_identical=Mock(side_effect=[False, False]),
ConfigProxy=config_proxy_mock,
):
self.module = netscaler_ssl_certkey
self.exited()
ssl_certkey_proxy_mock.assert_not_called()
示例4: test_present_server_identical_flow
# 需要导入模块: from ansible.compat.tests.mock import Mock [as 别名]
# 或者: from ansible.compat.tests.mock.Mock import assert_not_called [as 别名]
def test_present_server_identical_flow(self):
set_module_args(dict(
nitro_user='user',
nitro_pass='pass',
nsip='1.1.1.1',
state='present',
))
from ansible.modules.network.netscaler import netscaler_server
client_mock = Mock()
m = Mock(return_value=client_mock)
server_proxy_attrs = {
'diff_object.return_value': {},
}
server_proxy_mock = Mock()
server_proxy_mock.configure_mock(**server_proxy_attrs)
config_proxy_mock = Mock(return_value=server_proxy_mock)
with patch.multiple(
'ansible.modules.network.netscaler.netscaler_server',
get_nitro_client=m,
diff_list=Mock(return_value={}),
get_immutables_intersection=Mock(return_value=[]),
server_exists=Mock(side_effect=[True, True]),
server_identical=Mock(side_effect=[True, True]),
ConfigProxy=config_proxy_mock,
do_state_change=Mock(return_value=Mock(errorcode=0))
):
self.module = netscaler_server
self.exited()
server_proxy_mock.assert_not_called()