예제 #1
0
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")
예제 #2
0
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"
예제 #3
0
def test_render_cmd_no_template():
    """
    Tests return when template=None
    """
    assert cmdmod._render_cmd("foo", "bar", None) == ("foo", "bar")
예제 #4
0
 def test_render_cmd_no_template(self):
     '''
     Tests return when template=None
     '''
     self.assertEqual(cmdmod._render_cmd('foo', 'bar', None),
                      ('foo', 'bar'))
예제 #5
0
 def test_render_cmd_no_template(self):
     """
     Tests return when template=None
     """
     self.assertEqual(cmdmod._render_cmd("foo", "bar", None),
                      ("foo", "bar"))
예제 #6
0
파일: cmdmod_test.py 프로젝트: bryson/salt
 def test_render_cmd_no_template(self):
     '''
     Tests return when template=None
     '''
     self.assertEqual(cmdmod._render_cmd('foo', 'bar', None),
                      ('foo', 'bar'))
예제 #7
0
 def test_render_cmd_no_template(self):
     """
     Tests return when template=None
     """
     self.assertEqual(cmdmod._render_cmd("foo", "bar", None), ("foo", "bar"))