Example #1
0
def trace_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.request('TRACE',
                                        url,
                                        headers=context.headers,
                                        auth=context.auth,
                                        verify=context.verify_ssl)
Example #2
0
def put_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.put(url,
                                    data=context.data,
                                    headers=context.headers,
                                    auth=context.auth,
                                    verify=context.verify_ssl)
Example #3
0
def poll_GET(context, url_path_segment, jsonpath):
    json_value = json.loads(context.data.decode('utf-8'))
    url = append_path(context.server, url_path_segment)
    for i in range(context.n_attempts):
        response = requests.get(
            url, headers=context.headers, auth=context.auth)
        if jpath.get(jsonpath, response.json()) == json_value:
            context.response = response
            return
        time.sleep(context.pause_between_attempts)
    raise AssertionError(
        'Condition not met after %d attempts' %
        context.n_attempts)  # pragma: no cover
Example #4
0
def delete_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.delete(url,
                                       headers=context.headers,
                                       auth=context.auth,
                                       verify=context.verify_ssl)
Example #5
0
def options_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.options(
        url, headers=context.headers, auth=context.auth)
Example #6
0
def post_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.post(
        url, data=context.data, headers=context.headers, auth=context.auth)
Example #7
0
def delete_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.delete(
        url, headers=context.headers, auth=context.auth)
Example #8
0
def patch_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.patch(
        url, data=context.data, headers=context.headers, auth=context.auth)
Example #9
0
def trace_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.request(
        'TRACE', url, headers=context.headers, auth=context.auth)
Example #10
0
def get_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = get_requests(context).get(url,
                                                 headers=context.headers,
                                                 auth=context.auth,
                                                 verify=context.verify_ssl)
Example #11
0
def head_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.head(
        url, headers=context.headers, auth=context.auth,
        verify=context.verify_ssl)
Example #12
0
def patch_request(context, url_path_segment):
    url = append_path(context.server, url_path_segment)
    context.response = requests.patch(
        url, data=context.data, headers=context.headers, auth=context.auth,
        verify=context.verify_ssl)