mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
set exception handler by request format, not always HTML
This commit is contained in:
committed by
Marc Tobias Metten
parent
2467e9996e
commit
e4a51e460e
@@ -494,6 +494,18 @@ def step_impl(context, fmt):
|
||||
context.execute_steps("Then a HTTP 200 is returned")
|
||||
eq_(context.response.format, fmt)
|
||||
|
||||
@then(u'a (?P<fmt>\w+) user error is returned')
|
||||
def check_page_error(context, fmt):
|
||||
context.execute_steps("Then a HTTP 400 is returned")
|
||||
eq_(context.response.format, fmt)
|
||||
|
||||
if fmt == 'html':
|
||||
assert_is_not_none(re.search(r'<html( |>).+</html>', context.response.page, re.DOTALL))
|
||||
elif fmt == 'xml':
|
||||
assert_is_not_none(re.search(r'<error>.+</error>', context.response.page, re.DOTALL))
|
||||
else:
|
||||
assert_is_not_none(re.search(r'({"error":)', context.response.page, re.DOTALL))
|
||||
|
||||
@then(u'result header contains')
|
||||
def check_header_attr(context):
|
||||
for line in context.table:
|
||||
|
||||
Reference in New Issue
Block a user