Skip to content
Myr

need to test against raw header

Before adoption: this commit came in with the history the project adopted, so no landing records it.

parsing prefers the last value parsed for the option

authored by David Lord · committed by David Lord · parent c197301 · Browse files · 1 file+8 added−13 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−13 removed

  • tests:+8 added−13 removed

1 file+8 added−13 removed

modified:tests/test_helpers.py+8 added-13 removed
539 unmodified lines
540 value, options = \541 parse_options_header(rv.headers['Content-Disposition'])542 assert value == 'attachment'543 assert options['filename'] == 'index.html'544 assert 'filename*' not in options544 assert 'filename*' not in rv.headers['Content-Disposition']545 rv.close()546547 with app.test_request_context():548 rv = flask.send_file('static/index.html', as_attachment=True)
15 unmodified lines
564 def test_attachment_with_utf8_filename(self):565 app = flask.Flask(__name__)566567 with app.test_request_context():568 rv = flask.send_file(569 'static/index.html', as_attachment=True,570 attachment_filename=u'Ñandú/pingüino.txt'571 )572 value, options = parse_options_header(573 rv.headers['Content-Disposition']574 )568 rv = flask.send_file('static/index.html', as_attachment=True, attachment_filename=u'Ñandú/pingüino.txt')569 content_disposition = set(rv.headers['Content-Disposition'].split('; '))570 assert content_disposition == set((571 'attachment',572 'filename="Nandu/pinguino.txt"',573 "filename*=UTF-8''%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt"574 ))575 rv.close()576577 assert value == 'attachment'578 assert sorted(options.keys()) == ('filename', 'filename*')579 assert options['filename'] == 'Nandu/pinguino.txt'580 assert options['filename*'] == 'UTF-8''%C3%91and%C3%BA%EF%BC%8Fping%C3%BCino.txt'581577 def test_static_file(self):578 app = flask.Flask(__name__)579 # default cache timeout is 12 hours580 with app.test_request_context():
323 unmodified lines