Mercurial > hg > FileServer
diff tests/test_fileapp.txt @ 29:d8b73d9b679d
separate testing fileapp to its own doctest file
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 05 Mar 2012 13:27:06 -0800 |
parents | |
children | 52103702a732 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test_fileapp.txt Mon Mar 05 13:27:06 2012 -0800 @@ -0,0 +1,21 @@ +Test FileApp +============ + +The obligatory imports:: + + >>> import fileserver + >>> import os + >>> from paste.fixture import TestApp + +Make a single file server:: + + >>> filename = os.path.join(here, 'example', 'helloworld.txt') + >>> os.path.exists(filename) + True + >>> app = fileserver.FileApp(filename) + >>> testapp = TestApp(app) + >>> response = testapp.get('/') + >>> response.status + 200 + >>> response.body == file(filename).read() + True