def post(base_url, resource, content_format="text/plain", confirmable=True, use_token=True, use_block_option=False, block_size=64, payload="my interop test payload", filepath_payload=None): cmd = BASE_CMD.copy() cmd += ['{url}{resource_path}'.format(url=base_url, resource_path=resource)] cmd += ['-m', 'POST', '-t', str(content_format)] if filepath_payload: cmd += ['-f', filepath_payload] else: cmd += ['-e', payload] if not confirmable: cmd += ['-N'] if use_token: tkn = get_random_token() cmd += ['-T', str(tkn)] if use_block_option: block_option_val = '{start_number} {block_size}'.format(start_number=0, block_size=block_size) cmd += ['-b', str(block_option_val)] launch_short_automated_iut_process(cmd=cmd)
def put(base_url, resource, content_format="text/plain", confirmable=True, use_token=True, use_if_none_match=False, use_block_option=False, block_size=64, payload="my interop test payload", filepath_payload=None): """ Note: if a file to send is specified with filepath_payload argument, the payload argument is ignored. """ cmd = BASE_CMD.copy() cmd += ['{url}{resource_path}'.format(url=base_url, resource_path=resource)] cmd += ['-m', 'PUT', '-t', str(content_format)] if filepath_payload: cmd += ['-f', str(filepath_payload)] else: cmd += ['-e', str(payload)] if not confirmable: cmd += ['-N'] if use_token: tkn = get_random_token() cmd += ['-T', str(tkn)] if use_if_none_match: cmd += ['-O', str(5)] if use_block_option: block_option_val = '{start_number} {block_size}'.format(start_number=0, block_size=block_size) cmd += ['-b', str(block_option_val)] launch_short_automated_iut_process(cmd=cmd)
def delete(base_url, resource, confirmable=True, **kwargs): for k, v in kwargs.items(): logger.warning("ignoring {}:{}".format(k, v)) cmd = BASE_CMD.copy() cmd += [ '{url}{resource_path}'.format(url=base_url, resource_path=resource) ] cmd += ['-m', 'DELETE'] if not confirmable: cmd += ['--non'] launch_short_automated_iut_process(cmd)
def delete(base_url, resource, confirmable=True, use_token=True): cmd = BASE_CMD.copy() cmd += ['{url}{resource_path}'.format(url=base_url, resource_path=resource)] cmd += ['-m', 'DELETE'] if not confirmable: cmd += ['-N'] if use_token: tkn = get_random_token() cmd += ['-T', str(tkn)] launch_short_automated_iut_process(cmd=cmd)
def observe(base_url, resource, confirmable=True, duration=15, **kwargs): for k, v in kwargs.items(): logger.warning("ignoring {}:{}".format(k, v)) cmd = BASE_CMD.copy() cmd += [ '{url}{resource_path}'.format(url=base_url, resource_path=resource) ] cmd += ['--observe'] if not confirmable: cmd += ['--non'] # Let our client enough time receive some observation messages. launch_short_automated_iut_process(cmd, timeout=duration)
def observe(base_url, resource, confirmable=True, use_token=True, duration=15): cmd = BASE_CMD.copy() cmd += ['{url}{resource_path}'.format(url=base_url, resource_path=resource)] cmd += ['-s', str(duration)] if not confirmable: cmd += ['-N'] if use_token: tkn = get_random_token() cmd += ['-T', str(tkn)] launch_short_automated_iut_process(cmd=cmd, timeout=duration)
def get(base_url, resource, confirmable=True, accept_option=None, **kwargs): for k, v in kwargs.items(): logger.warning("ignoring {}:{}".format(k, v)) cmd = BASE_CMD.copy() cmd += [ '{url}{resource_path}'.format(url=base_url, resource_path=resource) ] cmd += ['-m', 'GET'] if accept_option is not None: cmd += [ '{option} {value}'.format(option='--accept', value=accept_option) ] if not confirmable: cmd += ['--non'] launch_short_automated_iut_process(cmd)
def get(base_url, resource, confirmable=True, use_token=True, accept_option=None, use_block_option=False, block_size=64,): cmd = BASE_CMD.copy() cmd += ['{url}{resource_path}'.format(url=base_url, resource_path=resource)] cmd += ['-m', 'GET'] if accept_option: cmd += ['-A', accept_option] if not confirmable: cmd += ['-N'] if use_token: tkn = get_random_token() cmd += ['-T', tkn] if use_block_option: block_option_val = '{start_number} {block_size}'.format(start_number=0, block_size=block_size) cmd += ['-b', str(block_option_val)] launch_short_automated_iut_process(cmd=cmd)
def post(base_url, resource, content_format="text/plain", confirmable=True, payload="'my interop test payload'", **kwargs): for k, v in kwargs.items(): logger.warning("ignoring {}:{}".format(k, v)) cmd = BASE_CMD.copy() cmd += [ '{url}{resource_path}'.format(url=base_url, resource_path=resource) ] cmd += [ '-m', 'POST', '--content-format', str(content_format), '--payload', str(payload) ] if not confirmable: cmd += ['--non'] launch_short_automated_iut_process(cmd)