bdd: Make expect_error handle warnings.

This commit is contained in:
Florian Bruhin 2015-11-03 22:40:19 +01:00
parent 85608a8b8d
commit 2427bf5cb6

View File

@ -72,12 +72,13 @@ def list_of_loaded_pages(httpbin, pages):
assert httpbin.get_requests() == requests assert httpbin.get_requests() == requests
@bdd.then(bdd.parsers.re(r'the (?P<category>error|message) "(?P<message>.*)" ' @bdd.then(bdd.parsers.re(r'the (?P<category>error|message|warning) '
r'should be shown.')) r'"(?P<message>.*)" should be shown.'))
def expect_error(quteproc, httpbin, category, message): def expect_error(quteproc, httpbin, category, message):
category_to_loglevel = { category_to_loglevel = {
'message': logging.INFO, 'message': logging.INFO,
'error': logging.ERROR, 'error': logging.ERROR,
'warning': logging.WARNING,
} }
message = message.replace('(port)', str(httpbin.port)) message = message.replace('(port)', str(httpbin.port))
quteproc.mark_expected(category='message', quteproc.mark_expected(category='message',