예제 #1
0
def test_user_lookup_handler_missing(conn):
    values = {'format': 'json', 'client': 'app1key', 'user': '******'}
    builder = EnvironBuilder(method='POST', data=values)
    handler = UserLookupHandler(connect=provider(conn))
    resp = handler.handle(Request(builder.get_environ()))
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    assert_equals('400 BAD REQUEST', resp.status)
    data = json.loads(resp.data)
    assert_equal('error', data['status'])
    assert_equal(6, data['error']['code'])
예제 #2
0
def test_user_lookup_handler_missing(conn):
    values = {'format': 'json', 'client': 'app1key', 'user': '******'}
    builder = EnvironBuilder(method='POST', data=values)
    handler = UserLookupHandler(connect=provider(conn))
    resp = handler.handle(Request(builder.get_environ()))
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    assert_equals('400 BAD REQUEST', resp.status)
    data = json.loads(resp.data)
    assert_equal('error', data['status'])
    assert_equal(6, data['error']['code'])
예제 #3
0
def test_user_lookup_handler(conn):
    values = {'format': 'json', 'client': 'app1key', 'user': '******'}
    builder = EnvironBuilder(method='POST', data=values)
    handler = UserLookupHandler(connect=provider(conn))
    resp = handler.handle(Request(builder.get_environ()))
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    assert_equals('200 OK', resp.status)
    data = json.loads(resp.data)
    assert_equal('ok', data['status'])
    assert_equal('user1key', data['user']['apikey'])
예제 #4
0
def test_user_lookup_handler(conn):
    values = {'format': 'json', 'client': 'app1key', 'user': '******'}
    builder = EnvironBuilder(method='POST', data=values)
    handler = UserLookupHandler(connect=provider(conn))
    resp = handler.handle(Request(builder.get_environ()))
    assert_equals('application/json; charset=UTF-8', resp.content_type)
    assert_equals('200 OK', resp.status)
    data = json.loads(resp.data)
    assert_equal('ok', data['status'])
    assert_equal('user1key', data['user']['apikey'])