Exemplo n.º 1
0
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == client.OK
    # TO DO

    if context.error is False:
        result = context.result
        message = ResponseReader.get_body(result)
        print(message)
        assert result.status_code == client.OK
Exemplo n.º 2
0
def step_impl(context):
    result = context.result
    from pyclaim.test.test_behave.test_utilities.response_reader import ResponseReader
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == client.OK
    # TO DO

    if context.error is False:
        result = context.result
        message = ResponseReader.get_body(result)
        print(message)
        assert result.status_code == client.OK
Exemplo n.º 3
0
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == client.OK
    # TO DO
    # assert message["user_name"] == context.user_name
    # assert message["claims"][0]['name'] == "USER_NAME"
    if context.error is False:
        result = context.result
        message = ResponseReader.get_body(result)
        print(message)
        assert result.status_code == client.OK
Exemplo n.º 4
0
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == ResponseStatusCodes.POST_SUCCESS
    # assert message == InfoCodes.DONE
    assert result.headers.get("token") is not None
Exemplo n.º 5
0
def step_impl(context):
    result = context.result
    assert result.status_code == ResponseStatusCodes.GET_SUCCESS
    message = ResponseReader.get_body(result)
    if message:
        for row in message:
            print(row, "\n")
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == ResponseStatusCodes.POST_SUCCESS
    # assert message["user_name"] == context.user_name
    # assert message["claims"][0]['claim_type_name'] == "USER_NAME"
    context.user_id = message
Exemplo n.º 7
0
def step_impl(context):
    claim_dict = {"claim_type_id": context.claimTypeId, "claim_value": str(ObjectId())}
    user_id = context.user_id
    headers = {"token": context.token}
    result = requests.post(Url.DOMAIN_ADDRESS + "/users/{}/claims".format(user_id), json=claim_dict, headers=headers)
    assert result.status_code == client.OK
    message = ResponseReader.get_body(result)
    context.claimId = message["claimId"]  # ?????????????????????????????????
    print(result)
Exemplo n.º 8
0
def step_impl(context, user_name):
    instance_factory = UserInstanceFactory()
    register_dict = instance_factory.create_user_dict()
    result = requests.post(Url.DOMAIN_ADDRESS + Url.REGISTER_ROUTE, json=register_dict)
    context.result = result
    print("response : ", result, "\n")
    assert result.status_code == ResponseStatusCodes.POST_SUCCESS
    message = ResponseReader.get_body(result)
    token = result.headers.get("token")
    user = {"user_name": register_dict["user_name"], "password": register_dict["password"], "token": token, "id": message}
    users = getattr(context, "users", None)
    if not users:
        context.users = {}
    context.users[user_name] = user
Exemplo n.º 9
0
def step_impl(context):
    result = context.result
    assert result.status_code == ResponseStatusCodes.BAD_REQUEST_ERROR
    message = ResponseReader.get_body(result)
    print(message)
Exemplo n.º 10
0
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print("\nmessage: ", message)
    assert result.status_code == ResponseStatusCodes.GET_SUCCESS
Exemplo n.º 11
0
def step_impl(context):
    result = context.result
    assert result.status_code == ResponseStatusCodes.GET_SUCCESS
    message = ResponseReader.get_body(result)
    print(message)
    assert message["user_name"] == context.user_name.lower()
Exemplo n.º 12
0
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == ResponseStatusCodes.NOT_AUTHORIZED_ERROR
Exemplo n.º 13
0
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print(message)
    assert result.status_code == client.OK
    context.claimId = message["claimId"]  # ?????????
def step_impl(context):
    result = context.result
    message = ResponseReader.get_body(result)
    print("\nmessage: ", message)
    assert result.status_code == client.OK