Example #1
0
def release_claim(*claim_response):
    """Deletes claim & verifies the delete was successful.

    Extracts claim id from the POST response input & deletes the claim.
    If DELETE claim succeeds, verifies that a GET claim returns 404.
    :param *claim_response: [header, body] returned for post claim request.
    """
    test_result_flag = False

    headers = claim_response[0]
    location = headers['Location']
    url = functionlib.create_url_from_appender(location)
    header = functionlib.create_marconi_headers()

    release_response = http.delete(url, header)
    if release_response.status_code == 204:
        test_result_flag = functionlib.verify_delete(url, header)
    else:
        print 'Release Claim HTTP code:{}'.format(release_response.status_code)
        print release_response.headers
        print release_response.text
        assert test_result_flag, 'Release Claim Failed'

    if not test_result_flag:
        assert test_result_flag, 'Get claim after the release failed'
Example #2
0
def delete_msg(*postresponse):
    """Post DELETE message & verifies that a subsequent GET returns 404.

    :param *postresponse: [headers, body] returned for post message request.
    """
    test_result_flag = False
    headers = str(postresponse[0])
    headers = headers.replace("'", '"')
    headers = json.loads(headers)
    location = headers['location']
    url = functionlib.create_url_from_appender(location)
    header = functionlib.create_marconi_headers()
    deletemsg = http.delete(url, header)
    if deletemsg.status_code == 204:
        test_result_flag = functionlib.verify_delete(url, header)
    else:
        print('DELETE message failed')
        print('URL')
        print(url)
        print('headers')
        print(header)
        print('Response Body')
        print(deletemsg.text)
        print('DELETE Code {}'.format(deletemsg.status_code))

    return test_result_flag
Example #3
0
def delete_claimed_msgs(*claim_response):
    """Deletes claimed messages.

    Verifies that the deletes were successful with a GET on the deleted msg.
    :param *claim_response: [header, body] returned for post claim request.
    """
    test_result_flag = False

    urllist = create_urllist_fromhref(*claim_response)
    header = functionlib.create_marconi_headers()

    for url in urllist:
        delete_response = http.delete(url, header)
        if delete_response.status_code == 204:
            test_result_flag = functionlib.verify_delete(url, header)
        else:
            print 'DELETE message with claim ID: {}'.format(url)
            print delete_response.status_code
            print delete_response.headers
            print delete_response.text
            print 'Delete Claimed Message Failed'

    return test_result_flag