Added a test for sending from directories

This commit is contained in:
Armin Ronacher 2014-02-09 13:06:54 +00:00
parent 76e2f9cd03
commit 8cb79fd026

View file

@ -368,6 +368,16 @@ class SendfileTestCase(FlaskTestCase):
self.assert_equal(cc.max_age, 10)
rv.close()
def test_send_from_directory(self):
app = flask.Flask(__name__)
app.testing = True
app.root_path = os.path.join(os.path.dirname(__file__),
'test_apps', 'subdomaintestmodule')
with app.test_request_context():
rv = flask.send_from_directory('static', 'hello.txt')
rv.direct_passthrough = False
self.assert_equal(rv.get_data().strip(), b'Hello Subdomain')
class LoggingTestCase(FlaskTestCase):