def test_all_table_entries(harness, files, request_uri, expected):
# set up the specified files
realfiles = tuple([ f if f.endswith('/') else (f, GENERIC_SPT) for f in files ])
harness.fs.www.mk(*realfiles)
try:
state = harness._hit('GET', request_uri, want='state',
return_after='dispatch_path_to_filesystem')
except exceptions.NotFound:
result = '404'
except exceptions.Redirect as err:
result = '302 ' + err.message
else:
result = '200'
path = format_result(**state)
if os.sep != posixpath.sep:
path = path.replace(os.sep, posixpath.sep)
path = path[len(harness.fs.www.root)+1:]
if path:
result += " " + path
if expected.endswith("*"):
expected = expected[:-1]
assert result == expected, "Requesting %r, got %r instead of %r" % (request_uri, result, expected)
评论列表
文章目录