Include an invalid items test for state.template* functions. Refs #2068.

This commit is contained in:
Pedro Algarvio 2012-09-28 17:56:13 +01:00
parent b28a80fab0
commit 7f7b196f1e

View File

@ -268,6 +268,28 @@ fi
if os.path.isdir(venv_dir):
shutil.rmtree(venv_dir)
def test_template_invalid_items(self):
TEMPLATE = '''\
{0}:
- issue-2068-template-str
/tmp/test-template-invalid-items:
file:
- managed
- source: salt://testfile
'''
for item in ('include', 'exclude', 'extends'):
ret = self.run_function(
'state.template_str', [TEMPLATE.format(item)]
)
self.assertTrue(isinstance(ret, list))
self.assertNotEqual(ret, [])
self.assertEqual(
['The \'{0}\' declaration found on \'<template-str>\' is '
'invalid when rendering single templates'.format(item)],
ret
)
if __name__ == '__main__':
from integration import run_tests