# HG changeset patch # User Jeff Hammel # Date 1330555733 28800 # Node ID 4d1852cfc077a281e060c48a5d95a94adabb65e1 # Parent 623358c3ebde299f1e75f35916565b9f160c2dd6 rudimentary test for directory server diff -r 623358c3ebde -r 4d1852cfc077 tests/doctest.txt --- a/tests/doctest.txt Wed Feb 29 14:44:04 2012 -0800 +++ b/tests/doctest.txt Wed Feb 29 14:48:53 2012 -0800 @@ -19,3 +19,17 @@ 200 >>> response.body == file(filename).read() True + +Make a directory server:: + + >>> directory = os.path.join(here, 'example') + >>> os.path.exists(directory) and os.path.isdir(directory) + True + >>> app = fileserver.DirectoryServer(directory) + >>> testapp = TestApp(app) + >>> response = testapp.get('/') + >>> response.status + 200 + >>> 'helloworld.txt' in response.body + True + diff -r 623358c3ebde -r 4d1852cfc077 tests/test.py --- a/tests/test.py Wed Feb 29 14:44:04 2012 -0800 +++ b/tests/test.py Wed Feb 29 14:48:53 2012 -0800 @@ -22,8 +22,8 @@ doctest_args['optionflags'] = doctest.REPORT_ONLY_FIRST_FAILURE # gather tests - tests = [ test for test in os.listdir(directory) - if test.endswith('.txt') ] + tests = [test for test in os.listdir(directory) + if test.endswith('.txt')] # run the tests for test in tests: