mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Test for unreadable directory (can't generate listing).
This commit is contained in:
parent
d5bd7558f4
commit
81b1bcbd74
@ -21,6 +21,8 @@ fi
|
||||
mkdir $DIR || exit 1
|
||||
mkdir $DIR/forbidden || exit 1
|
||||
chmod 0 $DIR/forbidden || exit 1
|
||||
mkdir $DIR/unreadable || exit 1
|
||||
chmod 0100 $DIR/unreadable || exit 1
|
||||
rm -f darkhttpd.gcda darkhttpd.log
|
||||
|
||||
echo "===> test_make_safe_uri"
|
||||
|
@ -87,6 +87,11 @@ class TestHelper(unittest.TestCase):
|
||||
"You don't have permission to access (%s).\n"%path,
|
||||
'Generated by darkhttpd')
|
||||
|
||||
def assertUnreadable(self, body, path):
|
||||
self.assertContains(body,
|
||||
"Couldn't list directory: Permission denied\n",
|
||||
'Generated by darkhttpd')
|
||||
|
||||
def drive_range(self, range_in, range_out, len_out, data_out,
|
||||
status_out = "206 Partial Content"):
|
||||
resp = Conn().get(self.url, req_hdrs = {"Range": "bytes="+range_in})
|
||||
@ -175,6 +180,7 @@ def setUpModule():
|
||||
["fancy invalid up dir", "/./dir/./../../", "assertIsInvalid"],
|
||||
["not found", "/not_found.txt", "assertNotFound"],
|
||||
["forbidden", "/forbidden/x", "assertForbidden"],
|
||||
["unreadable", "/unreadable/", "assertUnreadable"],
|
||||
]:
|
||||
makeSimpleCases(*args)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user