def test_render_cmd_unavailable_engine(): """ Tests CommandExecutionError raised when template isn't in the template registry """ with pytest.raises(CommandExecutionError): cmdmod._render_cmd("boo", "bar", "baz")
def test_render_cmd_saltenv_from_config(): mock_template = MagicMock() with patch.dict(cmdmod.__opts__, {"saltenv": "base"}): with patch.dict("salt.utils.templates.TEMPLATE_REGISTRY", {"test": mock_template}): cmdmod._render_cmd("test", "test", "test") assert mock_template.call_count == 2 assert mock_template.call_args[1]["saltenv"] == "base" cmdmod._render_cmd("test", "test", "test", saltenv="fake") assert mock_template.call_count == 4 assert mock_template.call_args[1]["saltenv"] == "fake"
def test_render_cmd_no_template(): """ Tests return when template=None """ assert cmdmod._render_cmd("foo", "bar", None) == ("foo", "bar")
def test_render_cmd_no_template(self): ''' Tests return when template=None ''' self.assertEqual(cmdmod._render_cmd('foo', 'bar', None), ('foo', 'bar'))
def test_render_cmd_no_template(self): """ Tests return when template=None """ self.assertEqual(cmdmod._render_cmd("foo", "bar", None), ("foo", "bar"))