Skip to content
Myr

added a new test case with a Response instance and cleaned up the code

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

authored by Mikael Åhlén · committed by Mikael Åhlén · parent 70f8b39 · Browse files · 1 file+17 added−9 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+17 added−9 removed

  • other:+17 added−9 removed

1 file+17 added−9 removed

modified:flask/testsuite/basic.py+17 added-9 removed
734 unmodified lines
735 return 'Meh', 400, {736 'X-Foo': 'Testing',737 'Content-Type': 'text/plain; charset=utf-8'738 } 739 @app.route("/two_args")739 @app.route('/two_args')740 def from_two_args_tuple():741 return "Hello", {741 return 'Hello', {742 'X-Foo': 'Test',743 'Content-Type': 'text/plain; charset=utf-8'744 }745 @app.route("/args_status")745 @app.route('/args_status')746 def from_status_tuple():747 return "Hi, status!", 400747 return 'Hi, status!', 400748 @app.route('/args_header')749 def from_response_instance_status_tuple():750 return flask.Response('Hello world', 404), {751 "X-Foo": "Bar",752 "X-Bar": "Foo"753 }754755 c = app.test_client()756 self.assert_equal(c.get('/unicode').data, u'Hällo Wörld'.encode('utf-8'))757 self.assert_equal(c.get('/string').data, u'Hällo Wörld'.encode('utf-8'))
1 unmodified line
759 self.assert_equal(rv.data, b'Meh')760 self.assert_equal(rv.headers['X-Foo'], 'Testing')761 self.assert_equal(rv.status_code, 400)762 self.assert_equal(rv.mimetype, 'text/plain')757758 rv2 = c.get("/two_args")763 rv2 = c.get('/two_args')764 self.assert_equal(rv2.data, b'Hello')765 self.assert_equal(rv2.headers['X-Foo'], 'Test')766 self.assert_equal(rv2.status_code, 200)767 self.assert_equal(rv2.mimetype, 'text/plain')763764 rv3 = c.get("/args_status")768 rv3 = c.get('/args_status')769 self.assert_equal(rv3.data, b'Hi, status!')770 self.assert_equal(rv3.status_code, 400)771 self.assert_equal(rv3.mimetype, 'text/html')772 rv4 = c.get('/args_header')773 self.assert_equal(rv4.data, b'Hello world')774 self.assert_equal(rv4.headers['X-Foo'], 'Bar')775 self.assert_equal(rv4.headers['X-Bar'], 'Foo')776 self.assert_equal(rv4.status_code, 404)777769778 def test_make_response(self):779 app = flask.Flask(__name__)780 with app.test_request_context():781 rv = flask.make_response()
553 unmodified lines