From 1e79aae231780b9292cc444b876de9f3400f701e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 23 Nov 2015 14:37:40 +0100 Subject: [PATCH] bdd: Add check_header step. --- tests/integration/features/conftest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 76e56962d..24fc46d03 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -21,6 +21,7 @@ import re import time +import json import logging import yaml @@ -159,3 +160,15 @@ def no_crash(): This is actually a NOP as a crash is already checked in the log.""" pass + + +@bdd.then(bdd.parsers.parse("the header {header} should be set to {value}")) +def check_header(quteproc, header, value): + """Check if a given header is set correctly. + + This assumes we're on the httpbin header page. + """ + content = quteproc.get_content() + data = json.loads(content) + print(data) + assert data['headers'][header] == value