|
|
|
@ -304,8 +304,11 @@ class SendfileTestCase(FlaskTestCase):
|
|
|
|
|
# etags |
|
|
|
|
self.assert_equal(len(captured), 1) |
|
|
|
|
with catch_warnings() as captured: |
|
|
|
|
class PyStringIO(StringIO): |
|
|
|
|
pass |
|
|
|
|
class PyStringIO(object): |
|
|
|
|
def __init__(self, *args, **kwargs): |
|
|
|
|
self._io = StringIO(*args, **kwargs) |
|
|
|
|
def __getattr__(self, name): |
|
|
|
|
return getattr(self._io, name) |
|
|
|
|
f = PyStringIO('Test') |
|
|
|
|
f.name = 'test.txt' |
|
|
|
|
rv = flask.send_file(f) |
|
|
|
@ -407,6 +410,17 @@ 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') |
|
|
|
|
rv.close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LoggingTestCase(FlaskTestCase): |
|
|
|
|
|
|
|
|
|