Files
pecan/tests/test_static.py
Jonathan LaCour 31c2d31565 A bunch of changes from last night, late:
* Secured controller support.
 * Static file support.
2010-09-29 11:18:06 -04:00

21 lines
725 B
Python

from pecan import expose, make_app
from webtest import TestApp
class TestStatic(object):
def test_simple_static(self):
class RootController(object):
@expose()
def index(self):
return 'Hello, World!'
# make sure Cascade is working properly
app = TestApp(make_app(RootController(), static_root='tests/static'))
response = app.get('/index.html')
assert response.status_int == 200
assert response.body == 'Hello, World!'
# get a static resource
response = app.get('/test.txt')
assert response.status_int == 200
assert response.body == open('tests/static/test.txt', 'rb').read()