def non_python_root_path_test(): handler_runner = partial(_check_main_index_path, path=['not_python', 'nose'], is_index=True) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on non-"/python/" path')
def typical_usage_test(): def handler_runner(): InvalidPathHandler().handle(path=['path', 'little', 'too', 'long'], request=None, response=None) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to raise 404 on invalid path')
def non_python_root_path_test(): handler_runner = partial( _check_main_index_path, path=['not_python', 'nose'], is_index=True) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on non-"/python/" path')
def http_get_fn_exception_test(): handler_runner = partial(_check_main_index_path, path=['python', 'nose'], is_index=True, http_get_exception=RequestException()) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on failure to get index')
def typical_usage_test(): def handler_runner(): InvalidPathHandler().handle( path=['path', 'little', 'too', 'long'], request=None, response=None) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to raise 404 on invalid path')
def parse_index_fn_exception_test(): handler_runner = partial(_check_main_index_path, path=['python', 'nose'], is_index=True, parse_index_exception=ParseError( None, None, None, None)) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on failure to parse index')
def http_get_fn_exception_test(): handler_runner = partial( _check_main_index_path, path=['python', 'nose'], is_index=True, http_get_exception=RequestException()) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on failure to get index')
def parse_index_fn_exception_test(): handler_runner = partial( _check_main_index_path, path=['python', 'nose'], is_index=True, parse_index_exception=ParseError(None, None, None, None)) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on failure to parse index')
def handle_non_existent_sha1_request_test(): file_entry = _generate_file_entry(has_sha1=False) handler_runner = partial( _check_file_handler, file_entry=file_entry, file_requested=file_entry.filename + '.sha1') assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 for non-existent file')
def handle_non_existent_file_request_test(): file_entry = _generate_file_entry() handler_runner = partial( _check_file_handler, file_entry=file_entry, file_requested='non-existent.tar.gz') assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 for non-existent file')
def non_python_root_path_test(): file_entry = _generate_file_entry() handler_runner = partial( _check_file_handler, file_entry=file_entry, file_requested=file_entry.filename, root_dir='not_python') assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on non-"/python/" path')
def parse_index_fn_exception_test(): file_entry = _generate_file_entry() handler_runner = partial( _check_file_handler, file_entry=file_entry, file_requested=file_entry.filename, parse_index_exception=ParseError(None, None, None, None)) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on failure to parse index')
def http_get_fn_exception_test(): file_entry = _generate_file_entry() handler_runner = partial( _check_file_handler, file_entry=file_entry, file_requested=file_entry.filename, http_get_exception=RequestException()) assert_http_not_found( run_handler_fn=handler_runner, failure_description='Failed to return 404 on failure to get index')