Browse Source

need to test against raw header

parsing prefers the last value parsed for the option
pull/2223/head
David Lord 8 years ago
parent
commit
f790ab7177
No known key found for this signature in database
GPG Key ID: 7A1C87E3F5BC42A8
  1. 21
      tests/test_helpers.py

21
tests/test_helpers.py

@ -541,7 +541,7 @@ class TestSendfile(object):
parse_options_header(rv.headers['Content-Disposition'])
assert value == 'attachment'
assert options['filename'] == 'index.html'
assert 'filename*' not in options
assert 'filename*' not in rv.headers['Content-Disposition']
rv.close()
with app.test_request_context():
@ -565,20 +565,15 @@ class TestSendfile(object):
app = flask.Flask(__name__)
with app.test_request_context():
rv = flask.send_file(
'static/index.html', as_attachment=True,
attachment_filename=u'Ñandú/pingüino.txt'
)
value, options = parse_options_header(
rv.headers['Content-Disposition']
)
rv = flask.send_file('static/index.html', as_attachment=True, attachment_filename=u'Ñandú/pingüino.txt')
content_disposition = set(rv.headers['Content-Disposition'].split('; '))
assert content_disposition == set((
'attachment',
'filename="Nandu/pinguino.txt"',
"filename*=UTF-8''%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt"
))
rv.close()
assert value == 'attachment'
assert sorted(options.keys()) == ('filename', 'filename*')
assert options['filename'] == 'Nandu/pinguino.txt'
assert options['filename*'] == 'UTF-8''%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt'
def test_static_file(self):
app = flask.Flask(__name__)
# default cache timeout is 12 hours

Loading…
Cancel
Save