コード例 #1
0
 def test_apply_template_on_contents(self):
     '''
     Tests that the templating engine works on string contents
     '''
     contents = 'This is a {{ template }}.'
     defaults = {'template': 'templated file'}
     ret = filemod.apply_template_on_contents(
         contents,
         template='jinja',
         context={'opts': filemod.__opts__},
         defaults=defaults,
         saltenv='base')
     self.assertEqual(ret, 'This is a templated file.')
コード例 #2
0
ファイル: file_test.py プロジェクト: bryson/salt
 def test_apply_template_on_contents(self):
     '''
     Tests that the templating engine works on string contents
     '''
     contents = 'This is a {{ template }}.'
     defaults = {'template': 'templated file'}
     ret = filemod.apply_template_on_contents(
         contents,
         template='jinja',
         context={'opts': filemod.__opts__},
         defaults=defaults,
         saltenv='base')
     self.assertEqual(ret, 'This is a templated file.')
コード例 #3
0
 def test_apply_template_on_contents(self):
     '''
     Tests that the templating engine works on string contents
     '''
     contents = 'This is a {{ template }}.'
     defaults = {'template': 'templated file'}
     with patch.object(SaltCacheLoader, 'file_client', Mock()):
         ret = filemod.apply_template_on_contents(
             contents,
             template='jinja',
             context={'opts': filemod.__opts__},
             defaults=defaults,
             saltenv='base')
     self.assertEqual(ret, 'This is a templated file.')
コード例 #4
0
ファイル: test_file_module.py プロジェクト: waynew/salt
def test_apply_template_on_contents():
    """
    Tests that the templating engine works on string contents
    """
    contents = "This is a {{ template }}."
    defaults = {"template": "templated file"}
    with patch.object(SaltCacheLoader, "file_client", Mock()):
        ret = filemod.apply_template_on_contents(
            contents,
            template="jinja",
            context={"opts": filemod.__opts__},
            defaults=defaults,
            saltenv="base",
        )
    assert ret == "This is a templated file."