Ejemplo n.º 1
0
def test_ping(rsession, args, token):
    url = iorio.format_url(args.host, args.port, 'ping')
    result = iorio.get_json(rsession, url, token)
    assert result.status_code == OK_STATUS
    body = parse(result.text)
    assert "pong" in body
    pong = body["pong"]
    assert isinstance(pong, str)
    assert len(pong) > 0
Ejemplo n.º 2
0
def test_ping(rsession, args, token):
    url = iorio.format_url(args.host, args.port, 'ping')
    result = iorio.get_json(rsession, url, token)
    assert result.status_code == OK_STATUS
    body = parse(result.text)
    assert "pong" in body
    pong = body["pong"]
    assert isinstance(pong, str)
    assert len(pong) > 0
Ejemplo n.º 3
0
def test_can_get_own_stream(session, args, token, user):
    bucket = user
    stream = "stream2"
    url = iorio.format_url(args.host, args.port, 'streams', bucket, stream)
    result = iorio.get_json(session, url, token)
    assert result.status_code == OK_STATUS
    body = parse(result.text)
    assert isinstance(body, list)
    assert len(body) == 0
Ejemplo n.º 4
0
def test_can_get_own_stream(session, args, token, user):
    bucket = user
    stream = "stream2"
    url = iorio.format_url(args.host, args.port, 'streams', bucket, stream)
    result = iorio.get_json(session, url, token)
    assert result.status_code == OK_STATUS
    body = parse(result.text)
    assert isinstance(body, list)
    assert len(body) == 0
Ejemplo n.º 5
0
def create_user(session, args, token, username, password):
    url = iorio.format_url(args.host, args.port, 'users')
    req_body = dict(username=username, password=password)
    return iorio.post_data_json(session, url, req_body, token)
Ejemplo n.º 6
0
def test_get_session(session, args, token, username):
    url = iorio.format_url(args.host, args.port, 'sessions')
    result = iorio.get_json(session, url, token)
    assert result.status_code == OK_STATUS
    body = parse(result.text)
    assert_field(body, "username", username)
Ejemplo n.º 7
0
def list_buckets(session, args, token):
    url = iorio.format_url(args.host, args.port, 'buckets')
    result = iorio.get_json(session, url, token)
    body = parse(result.text)
    return result, body
Ejemplo n.º 8
0
def call_access_bucket(session, args, token, bucket, access, username, action):
    url = iorio.format_url(args.host, args.port, 'access', bucket)
    data = dict(permission=access, username=username, action=action)
    return post(session, token, url, data)
Ejemplo n.º 9
0
def create_user(session, args, token, username, password):
    url = iorio.format_url(args.host, args.port, 'users')
    req_body = dict(username=username, password=password)
    return iorio.post_data_json(session, url, req_body, token)
Ejemplo n.º 10
0
def test_get_session(session, args, token, username):
    url = iorio.format_url(args.host, args.port, 'sessions')
    result = iorio.get_json(session, url, token)
    assert result.status_code == OK_STATUS
    body = parse(result.text)
    assert_field(body, "username", username)
Ejemplo n.º 11
0
def list_buckets(session, args, token):
    url = iorio.format_url(args.host, args.port, 'buckets')
    result = iorio.get_json(session, url, token)
    body = parse(result.text)
    return result, body
Ejemplo n.º 12
0
def call_access_bucket(session, args, token, bucket, access, username, action):
    url = iorio.format_url(args.host, args.port, 'access', bucket)
    data = dict(permission=access, username=username, action=action)
    return post(session, token, url, data)