Commit 928a1688 authored by Marek Vavrusa's avatar Marek Vavrusa

scenario: a virtual interface for checking logs

the client must provide scenario.log object,
that has a `match(self, patterns)` method
the self is a Step instance, patterns is just a list
of parameters passed to `STEP LOG [...]`
parent e0e7f62e
......@@ -359,7 +359,7 @@ class Step:
each step has an order identifier, type and optionally data entry.
require_data = ['TIME_PASSES']
require_data = ['QUERY', 'CHECK_ANSWER', 'REPLY']
def __init__(self, id, type, extra_args):
""" Initialize single scenario step. """
......@@ -367,7 +367,7 @@ class Step:
self.type = type
self.args = extra_args = []
self.has_data = self.type not in Step.require_data
self.has_data = self.type in Step.require_data
self.answer = None
self.raw_answer = None
self.repeat_if_fail = 0
......@@ -421,10 +421,13 @@ class Step:
elif self.type == 'REPLY':
dprint(dtag, '')
elif self.type == 'LOG':
if not ctx.log:
raise Exception('scenario has no log interface')
return ctx.log.match(self.args)
raise Exception('step %03d type %s unsupported' % (, self.type))
def __check_answer(self, ctx):
""" Compare answer from previously resolved query. """
if len( == 0:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment