Fixed some test failures

This commit is contained in:
Armin Ronacher 2013-05-30 17:58:27 +01:00
parent 9ae8487330
commit 90e3906d02
3 changed files with 7 additions and 2 deletions

View file

@ -513,7 +513,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
# test that all teardown_requests get passed the same original
# exception.
try:
raise TypeError
raise TypeError()
except:
pass
@app.teardown_request
@ -524,7 +524,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
# test that all teardown_requests get passed the same original
# exception.
try:
raise TypeError
raise TypeError()
except:
pass
@app.route('/')
@ -1098,7 +1098,9 @@ class SubdomainTestCase(FlaskTestCase):
app.register_module(mod)
c = app.test_client()
rv = c.get('/static/hello.txt', 'http://foo.example.com/')
rv.direct_passthrough = False
self.assert_equal(rv.data.strip(), b'Hello Subdomain')
rv.close()
def test_subdomain_matching(self):
app = flask.Flask(__name__)

View file

@ -371,6 +371,7 @@ class BlueprintTestCase(FlaskTestCase):
rv = c.get('/admin/static/css/test.css')
cc = parse_cache_control_header(rv.headers['Cache-Control'])
self.assert_equal(cc.max_age, expected_max_age)
rv.close()
finally:
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = max_age_default

View file

@ -206,6 +206,7 @@ class SendfileTestCase(FlaskTestCase):
with catch_warnings() as captured:
f = StringIO('Test')
rv = flask.send_file(f)
rv.direct_passthrough = False
self.assert_equal(rv.data, b'Test')
self.assert_equal(rv.mimetype, 'application/octet-stream')
rv.close()
@ -214,6 +215,7 @@ class SendfileTestCase(FlaskTestCase):
with catch_warnings() as captured:
f = StringIO('Test')
rv = flask.send_file(f, mimetype='text/plain')
rv.direct_passthrough = False
self.assert_equal(rv.data, b'Test')
self.assert_equal(rv.mimetype, 'text/plain')
rv.close()