forked from orbit-oss/flask
Fixed some test failures
This commit is contained in:
parent
9ae8487330
commit
90e3906d02
3 changed files with 7 additions and 2 deletions
|
|
@ -513,7 +513,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
|
||||||
# test that all teardown_requests get passed the same original
|
# test that all teardown_requests get passed the same original
|
||||||
# exception.
|
# exception.
|
||||||
try:
|
try:
|
||||||
raise TypeError
|
raise TypeError()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@app.teardown_request
|
@app.teardown_request
|
||||||
|
|
@ -524,7 +524,7 @@ class BasicFunctionalityTestCase(FlaskTestCase):
|
||||||
# test that all teardown_requests get passed the same original
|
# test that all teardown_requests get passed the same original
|
||||||
# exception.
|
# exception.
|
||||||
try:
|
try:
|
||||||
raise TypeError
|
raise TypeError()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@app.route('/')
|
@app.route('/')
|
||||||
|
|
@ -1098,7 +1098,9 @@ class SubdomainTestCase(FlaskTestCase):
|
||||||
app.register_module(mod)
|
app.register_module(mod)
|
||||||
c = app.test_client()
|
c = app.test_client()
|
||||||
rv = c.get('/static/hello.txt', 'http://foo.example.com/')
|
rv = c.get('/static/hello.txt', 'http://foo.example.com/')
|
||||||
|
rv.direct_passthrough = False
|
||||||
self.assert_equal(rv.data.strip(), b'Hello Subdomain')
|
self.assert_equal(rv.data.strip(), b'Hello Subdomain')
|
||||||
|
rv.close()
|
||||||
|
|
||||||
def test_subdomain_matching(self):
|
def test_subdomain_matching(self):
|
||||||
app = flask.Flask(__name__)
|
app = flask.Flask(__name__)
|
||||||
|
|
|
||||||
|
|
@ -371,6 +371,7 @@ class BlueprintTestCase(FlaskTestCase):
|
||||||
rv = c.get('/admin/static/css/test.css')
|
rv = c.get('/admin/static/css/test.css')
|
||||||
cc = parse_cache_control_header(rv.headers['Cache-Control'])
|
cc = parse_cache_control_header(rv.headers['Cache-Control'])
|
||||||
self.assert_equal(cc.max_age, expected_max_age)
|
self.assert_equal(cc.max_age, expected_max_age)
|
||||||
|
rv.close()
|
||||||
finally:
|
finally:
|
||||||
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = max_age_default
|
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = max_age_default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,7 @@ class SendfileTestCase(FlaskTestCase):
|
||||||
with catch_warnings() as captured:
|
with catch_warnings() as captured:
|
||||||
f = StringIO('Test')
|
f = StringIO('Test')
|
||||||
rv = flask.send_file(f)
|
rv = flask.send_file(f)
|
||||||
|
rv.direct_passthrough = False
|
||||||
self.assert_equal(rv.data, b'Test')
|
self.assert_equal(rv.data, b'Test')
|
||||||
self.assert_equal(rv.mimetype, 'application/octet-stream')
|
self.assert_equal(rv.mimetype, 'application/octet-stream')
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
@ -214,6 +215,7 @@ class SendfileTestCase(FlaskTestCase):
|
||||||
with catch_warnings() as captured:
|
with catch_warnings() as captured:
|
||||||
f = StringIO('Test')
|
f = StringIO('Test')
|
||||||
rv = flask.send_file(f, mimetype='text/plain')
|
rv = flask.send_file(f, mimetype='text/plain')
|
||||||
|
rv.direct_passthrough = False
|
||||||
self.assert_equal(rv.data, b'Test')
|
self.assert_equal(rv.data, b'Test')
|
||||||
self.assert_equal(rv.mimetype, 'text/plain')
|
self.assert_equal(rv.mimetype, 'text/plain')
|
||||||
rv.close()
|
rv.close()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue