Merge branch 'darkk-assert-with-msg' into devel

This commit is contained in:
James Cammarata 2014-07-08 14:05:50 -05:00
commit 33cfdc4cbf

View file

@ -38,8 +38,7 @@ class ActionModule(object):
args.update(complex_args)
args.update(utils.parse_kv(module_args))
msg = ''
msg = None
if 'msg' in args:
msg = args['msg']
@ -50,8 +49,16 @@ class ActionModule(object):
args['that'] = [ args['that'] ]
for that in args['that']:
result = utils.check_conditional(that, self.runner.basedir, inject, fail_on_undefined=True)
if not result:
return ReturnData(conn=conn, result=dict(failed=True, assertion=that, evaluated_to=result))
test_result = utils.check_conditional(that, self.runner.basedir, inject, fail_on_undefined=True)
if not test_result:
result = dict(
failed = True,
evaluated_to = test_result,
assertion = that,
)
if msg:
result['msg'] = msg
return ReturnData(conn=conn, result=result)
return ReturnData(conn=conn, result=dict(msg='all assertions passed'))