예제 #1
0
def test_json_response_defaults():
    response = jason.response()
    assert response.status_code == 200
    assert json.loads(response.content.decode("utf-8")) == {
        "status": 200, "message": "OK", "data": {}
    }
    assert response['Content-Type'] == 'application/json'
예제 #2
0
def test_json_response():
    response = jason.response({u'ØÆÅ': u'ø'}, 401, 'NO')
    assert response.status_code == 401
    assert json.loads(response.content.decode("utf-8"), encoding='utf-8') == {
        "status": 401, "message": "NO", "data": {u"ØÆÅ": u"ø"}
    }
    assert response['Content-Type'] == 'application/json'
예제 #3
0
def test_json_response_defaults():
    response = jason.response()
    assert response.status_code == 200
    assert json.loads(response.content.decode("utf-8")) == {
        "status": 200,
        "message": "OK",
        "data": {}
    }
    assert response['Content-Type'] == 'application/json'
예제 #4
0
def test_json_response():
    response = jason.response({u'ØÆÅ': u'ø'}, 401, 'NO')
    assert response.status_code == 401
    assert json.loads(response.content.decode("utf-8"), encoding='utf-8') == {
        "status": 401,
        "message": "NO",
        "data": {
            u"ØÆÅ": u"ø"
        }
    }
    assert response['Content-Type'] == 'application/json'