From ce38b998cdb0067a88aed79549fe66a1a5e10601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 8 Nov 2015 14:29:11 +0100 Subject: [PATCH] tests: add test for menu.json (and json/jsonp handling) --- tests/test_backoffice_pages.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_backoffice_pages.py b/tests/test_backoffice_pages.py index a28fb05..9f111bf 100644 --- a/tests/test_backoffice_pages.py +++ b/tests/test_backoffice_pages.py @@ -1077,3 +1077,16 @@ def test_count_backoffice_drafts(pub): assert resp.json['count'] == 1 resp = login(get_app(pub)).get('/backoffice/submission/count?mode=existing') assert resp.json['count'] == 2 + +def test_menu_json(pub): + user = create_user(pub) + create_environment(pub) + resp = login(get_app(pub)).get('/backoffice/menu.json') + menu_json_str = resp.body + assert len(resp.json) == 1 + assert resp.json[0]['slug'] == 'management' + assert resp.headers['content-type'] == 'application/json' + + resp = login(get_app(pub)).get('/backoffice/menu.json?jsonpCallback=foo') + assert resp.body == 'foo(%s);' % menu_json_str + assert resp.headers['content-type'] == 'application/javascript' -- 2.6.2