Moved test cases from #8195 to a better place.

This commit is contained in:
Pedro Algarvio 2013-10-31 16:42:59 +00:00
parent 245ebd120f
commit c849c4b57f
2 changed files with 16 additions and 35 deletions

View file

@ -346,6 +346,22 @@ fi
ret = self.run_function('state.sls', mods='pydsl-1')
self.assertSaltTrueReturn(ret)
def test_issues_7905_and_8174_sls_syntax_error(self):
'''
Call sls file with yaml syntax error.
Ensure theses errors are detected and presented to the user without
stack traces.
'''
ret = self.run_function('state.sls', mods='syntax.badlist')
self.assertEqual(ret, [
'The state "A" in sls syntax.badlist is not formed as a list'
])
ret = self.run_function('state.sls', mods='syntax.badlist2')
self.assertEqual(ret, [
'The state "C" in sls syntax.badlist2 is not formed as a list'
])
if __name__ == '__main__':
from integration import run_tests

View file

@ -29,41 +29,6 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
_call_binary_ = 'salt-call'
def test_issue_8174_sls_syntax_error(self):
'''
Call sls file with yaml syntax error.
Ensure theses errors are detected and presented to the user without stack traces.
'''
expected_comment = 'Data failed to compile:'
expected_comment_2 = 'is not formed as a list'
unexpected_comment = 'Traceback (most recent call last):'
stdout, retcode = self.run_call(
'-l quiet state.sls syntax.badlist',
with_retcode=True
)
# it was 1 with previous StackTrace error
self.assertEqual(0, retcode)
# check presence of clean error message
self.assertIn(expected_comment, ''.join(stdout))
self.assertIn(expected_comment_2, ''.join(stdout))
self.assertNotIn(unexpected_comment, ''.join(stdout))
def test_issue_7905_sls_syntax_error(self):
expected_comment = 'Data failed to compile:'
expected_comment_2 = 'is not formed as a list'
unexpected_comment = 'Traceback (most recent call last):'
stdout, retcode = self.run_call(
'-l quiet state.sls syntax.badlist2',
with_retcode=True
)
# it was 1 with previous StackTrace error
self.assertEqual(0, retcode)
# check presence of clean error message
self.assertIn(expected_comment, ''.join(stdout))
self.assertIn(expected_comment_2, ''.join(stdout))
self.assertNotIn(unexpected_comment, ''.join(stdout))
def test_default_output(self):
out = self.run_call('-l quiet test.fib 3')