Projet

Général

Profil

0001-tests-add-test-for-menu.json-and-json-jsonp-handling.patch

Frédéric Péters, 08 novembre 2015 14:29

Télécharger (1,25 ko)

Voir les différences:

Subject: [PATCH] tests: add test for menu.json (and json/jsonp handling)

 tests/test_backoffice_pages.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
tests/test_backoffice_pages.py
1077 1077
    assert resp.json['count'] == 1
1078 1078
    resp = login(get_app(pub)).get('/backoffice/submission/count?mode=existing')
1079 1079
    assert resp.json['count'] == 2
1080

  
1081
def test_menu_json(pub):
1082
    user = create_user(pub)
1083
    create_environment(pub)
1084
    resp = login(get_app(pub)).get('/backoffice/menu.json')
1085
    menu_json_str = resp.body
1086
    assert len(resp.json) == 1
1087
    assert resp.json[0]['slug'] == 'management'
1088
    assert resp.headers['content-type'] == 'application/json'
1089

  
1090
    resp = login(get_app(pub)).get('/backoffice/menu.json?jsonpCallback=foo')
1091
    assert resp.body == 'foo(%s);' % menu_json_str
1092
    assert resp.headers['content-type'] == 'application/javascript'
1080
-