def test_install_pyton_gdeploy_pip(): setattr(__builtin__, "NS", maps.NamedDict()) setattr(NS, "_int", maps.NamedDict()) NS["node_context"] = maps.NamedDict() NS.node_context["node_id"] = "Test_node_id" NS["config"] = maps.NamedDict() NS.config["data"] = maps.NamedDict() NS.config.data['package_source_type'] = 'pip' NS.publisher_id = "node_context" utils.install_python_gdeploy()
def test_install_python_gdeploy_fail(): setattr(__builtin__, "NS", maps.NamedDict()) setattr(NS, "_int", maps.NamedDict()) NS["node_context"] = maps.NamedDict() NS.node_context["node_id"] = "Test_node_id" NS["config"] = maps.NamedDict() NS.config["data"] = maps.NamedDict() NS.publisher_id = "node_context" NS.config.data['package_source_type'] = 'test' with pytest.raises(FlowExecutionFailedError): utils.install_python_gdeploy()
def test_install_pyton_gdeploy_gen_fail(): setattr(__builtin__, "NS", maps.NamedDict()) setattr(NS, "_int", maps.NamedDict()) NS["node_context"] = maps.NamedDict() NS.node_context["node_id"] = "Test_node_id" NS["config"] = maps.NamedDict() NS.config["data"] = maps.NamedDict() NS.config.data['package_source_type'] = 'pip' NS.publisher_id = "node_context" with patch.object(ansible_module_runner, 'AnsibleRunner', mock_runner): with pytest.raises(FlowExecutionFailedError): utils.install_python_gdeploy()
def test_install_python_gdeploy_exception(): setattr(__builtin__, "NS", maps.NamedDict()) setattr(NS, "_int", maps.NamedDict()) NS["node_context"] = maps.NamedDict() NS.node_context["node_id"] = "Test_node_id" NS["config"] = maps.NamedDict() NS.config["data"] = maps.NamedDict() NS.config.data['package_source_type'] = 'rpm' NS.publisher_id = "node_context" with patch.object(ansible_module_runner, 'AnsibleRunner', side_effect = ansible_module_runner.AnsibleModuleNotFound): # noqa with pytest.raises(ansible_module_runner.AnsibleModuleNotFound): utils.install_python_gdeploy()
def test_install_python_gdeploy_exception(): setattr(__builtin__, "NS", maps.NamedDict()) setattr(NS, "_int", maps.NamedDict()) NS["node_context"] = maps.NamedDict() NS.node_context["node_id"] = "Test_node_id" NS["config"] = maps.NamedDict() NS.config["data"] = maps.NamedDict() NS.config.data['package_source_type'] = 'rpm' NS.publisher_id = "node_context" with patch.object( ansible_module_runner, 'AnsibleRunner', side_effect=ansible_module_runner.AnsibleModuleNotFound): # noqa with pytest.raises(ansible_module_runner.AnsibleModuleNotFound): utils.install_python_gdeploy()