Esempio n. 1
0
def test_ok():
    handler = APIHandler()
    resp = handler._ok({'tracks': [{'id': 1, 'name': 'Track 1'}]}, 'json')
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    expected = '{"status": "ok", "tracks": [{"id": 1, "name": "Track 1"}]}'
    assert_equals(expected, resp.data)
    assert_equals('200 OK', resp.status)
Esempio n. 2
0
def test_ok():
    handler = APIHandler()
    resp = handler._ok({'tracks': [{'id': 1, 'name': 'Track 1'}]}, 'json')
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    expected = '{"status": "ok", "tracks": [{"id": 1, "name": "Track 1"}]}'
    assert_equals(expected, resp.data)
    assert_equals('200 OK', resp.status)
Esempio n. 3
0
def test_ok(ctx):
    # type: (ScriptContext) -> None
    handler = APIHandler(ctx)
    resp = handler._ok({'tracks': [{'id': 1, 'name': 'Track 1'}]}, 'json')
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    expected = {"status": "ok", "tracks": [{"id": 1, "name": "Track 1"}]}
    assert_json_equals(expected, resp.data)
    assert_equals('200 OK', resp.status)