From 573654ece128204eae3ef6019b19563f6276e239 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 14 Jan 2016 22:27:00 +0100 Subject: [PATCH] bdd: Add check_contents_json. --- tests/integration/features/conftest.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index ac77dcd89..2cc87ca33 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -373,6 +373,15 @@ def check_contents_plain(quteproc, text): assert text in content +@bdd.then(bdd.parsers.parse('the json on the page should be:\n{text}')) +def check_contents_json(quteproc, text): + """Check the current page's content as json.""" + content = quteproc.get_content().strip() + expected = json.loads(text) + actual = json.loads(content) + assert actual == expected + + @bdd.then(bdd.parsers.parse("the following tabs should be open:\n{tabs}")) def check_open_tabs(quteproc, tabs): """Check the list of open tabs in the session.