Commit graph

270 commits

Author SHA1 Message Date
David Lord
0e1e9a04aa
detect UTF encodings when loading json 2018-04-10 12:55:01 -07:00
ThiefMaster
c52e1b7388 Fix ValueError for some invalid Range requests
fixes #2526
2017-11-25 00:37:49 +01:00
David Lord
f7c35bf0d5 safe_join on Windows uses posixpath
fixes #2033
closes #2059
2017-05-16 08:34:37 +02:00
David Lord
4ff84d537a
get mtime in utc 2017-04-14 05:30:03 -07:00
Diggory Blake
6f7847e3c4 Make test more idiomatic 2017-03-31 18:40:46 +02:00
Diggory Blake
d0e2e7b66c Add test and changes 2017-03-31 18:40:46 +02:00
Paul Brown
0832e77b14 prevent NoAppException when ImportError occurs within imported module 2016-12-30 22:45:53 +01:00
Markus Unterwaditzer
789715adb9 Fix config.from_pyfile on Python 3 (#2123)
* Fix config.from_pyfile on Python 3

Fix #2118

* Support Python 2.6

* Fix tests on Python 2
2016-12-26 03:50:47 +01:00
Jiri Kuncar
36425d5f91 Ignore cache on request.get_json(cache=False) call (#2089)
* Test cache argument of Request.get_json

* Ignore cache on request.get_json(cache=False) call

Removes usage of `_cached_json` property when `get_json` is called with
disabled cache argument. (closes #2087)
2016-12-21 21:08:38 +01:00
Alex Kahan
2647fc7112 Parameterizing test (#2073) 2016-11-03 10:11:24 -07:00
Michael Recachinas
bd5e297aa9 Default environ (#2047)
* Add init to FlaskClient

This addresses #1467. The init in the subclass
can now take in `environ_base`, which will then get
passed to `make_test_environ_builder` and to
`EnvironBuilder` via keyword args.

This should provide the default environment capability
on `app.test_client()` init.

* Add kwarg `environ_base` to `make_test_environ_builder` call

This change now passes `environ_base` from either
`kwargs` in `FlaskClient.open` or `FlaskClient.environ_base`
if passed into the init.

* Fix assignment reference typo

* Add default `environ_base` to `FlaskClient.__init__`

* Set default kwargs for `environ_base` in `FlaskClient.open`

* Remove specific environ_base kwarg since its in kwargs

* Add docstring to FlaskClient detailing environ_base

* Document app.test_client default environ in CHANGES

* Re-word environ_base changes in FlaskClient docstring

* Add client.environ_base tests

* Mention preset default environ in `app.test_client`

* Add versionchanged directive to docstring in FlaskClient
2016-10-12 08:54:24 +02:00
Joël Charles
7186a5aaf5 make use of range requests if available in werkzeug (#2031)
* make use of range requests if available in werkzeug

* different logic for testing werkzeug functionality
2016-09-26 12:43:46 +02:00
Armin Ronacher
a40489e0ce Merge pull request #2019 from pallets/bugfix/sendfile-error
Do not cause errors for unknown files for sendfile
2016-09-12 21:52:42 +03:00
Armin Ronacher
a30951ec28 Do not error for unknown files if send_file sends an actual file 2016-09-10 03:33:53 +03:00
Armin Ronacher
9cd32cac32 Corrected after response for error handlers
Before this change after request functions were not correctly
invoked for error handlers.
2016-09-08 11:56:02 +03:00
Markus Unterwaditzer
c4ec6954e5 Don't passthrough_errors unless instructed. (#2006)
Fix #2005

Revert #1679 and #1996
2016-09-06 22:32:34 +02:00
Roman
92ce20eeac Fix error in send_file helper (#2003)
* Fix error in send_file (mimetype_filename is not defined)

* fix formatting error message in send_file
2016-09-04 16:28:05 -07:00
Markus Unterwaditzer
098ea0c8ca Only passthrough_errors if PROPAGATE_EXCEPTIONS
See pallets/werkzeug#954
2016-08-27 14:38:13 +02:00
Markus Unterwaditzer
71e10be286 Properly remove f.name usage in send_file (#1988)
* Properly remove f.name usage in send_file

* Update changelogs

* Fix tests
2016-08-26 03:08:03 +02:00
David Lord
f193f590bc clean up new json tests 2016-08-21 08:47:12 -07:00
Nathan Land
f16e477b2a Add tests for flask.json.dump() and test that jsonify correctly converts uuids. 2016-08-21 07:48:05 -07:00
Anton Sarukhanov
9121e109bd Add test for get_version (CLI) (#1884) 2016-08-20 17:43:58 +02:00
Nate Prewitt
0f1cf50f97 adding in try around __import__ to catch invalid files/paths (#1950) 2016-08-12 15:12:00 +02:00
Hyunchel Kim
f19d3bd67e Enhance tests.test_cli.test_find_best_app (#1882)
This commit adds a test case for `test_find_best_app` where
Module object does not contain Flask application.
Also cleans the function little bit to provides more meaningful comment.
2016-07-05 12:46:01 -07:00
Anton Sarukhanov
5eaed37116 Add test for find_default_import_path 2016-06-07 08:03:55 -04:00
David Lord
7c271401b2 pass value directly to last_modified 2016-06-05 12:42:34 -07:00
Prachi Shirish Khadke
af515cc7ea Add last_modified arg for send_file
Enhancement: Add last_modified arg of type DateTime to send_file.

Fixes pallets/flask#1321
2016-06-05 10:59:17 -07:00
Hyunchel Kim
64a37bb9b7 Test side effect (#1889)
Function `prepare_exec_for_file` has a side effect where a path is added to
`sys.path` list.
This commit enhances an exisiting test case for `prepare_exec_for_file`
by testing the side effect of the function and adding necessary
comments.
2016-06-05 10:32:00 -07:00
Giampaolo Eusebi
06a170ea9b Add tests for safe_join 2016-06-04 11:26:44 +02:00
dawran6
e048aa4e19 Add negative test for json.jsonify (#1876)
Test if jsonify function raises TypeError when both args and kwargs are
passed in.
Check the TypeError's message
2016-06-03 10:58:39 -07:00
jphilipsen05
fe5f714026 fixed unmatched elif (#1872) 2016-06-03 18:41:10 +02:00
Dan Sully
8458cc5cd1 Remove deprecation warnings for add_etags & mimetype guessing for send_file()
Fix #1849
2016-06-03 14:52:33 +02:00
Markus Unterwaditzer
6c359e0f53 Eliminate some resource warnings 2016-06-03 14:29:27 +02:00
Markus Unterwaditzer
293eb583f6 More explicit warning categories 2016-06-03 14:04:25 +02:00
Markus Unterwaditzer
d393597c50 Use recwarn everywhere
...instead of custom fixture. Also assert that no warnings are left over
after the test.
2016-06-03 13:59:47 +02:00
jphilipsen05
047efac537 Coverage for test_static_path_deprecated and test_static_url_path (#1860) 2016-06-02 17:56:08 -07:00
David Lord
024fbe5a60 Revert "Adds simplejson as a testing target." (#1865) 2016-06-02 14:54:49 -07:00
James Farrington
390cd5e4ee Fixed #1846 2016-06-02 11:58:02 -07:00
Armin Ronacher
8d7e7aab31 Merge pull request #1822 from pallets/bugfix/better-pop
Improve application context popping
2016-05-26 22:31:15 +02:00
Armin Ronacher
b13e83a2f2 Merge pull request #1813 from pallets/bugfix/scheme
Resolve state issue for url_for with forced scheme
2016-05-26 21:48:20 +02:00
Armin Ronacher
8482ce6b8c Improve application context popping
Exceptions during teardown handling will no longer leave application
contexts lingering around.  This fixes #1767
2016-05-26 21:46:56 +02:00
Armin Ronacher
523e271183 Implemented simplified CLI interface 2016-05-26 20:07:52 +02:00
dataforger
92f63a1c1d fix docstring (#1818)
change string to docstring
2016-05-24 21:06:34 +02:00
Armin Ronacher
6aee9f6d77 Resolve state issue for url_for with forced scheme
This fixes #1596
2016-05-22 10:45:29 +02:00
Armin Ronacher
883cb7cedc Always run gc before leak test 2016-05-22 10:34:48 +02:00
Jannis Leidel
88500f5cc7 Forward ported CLI tests from Flask-CLI and fixed a bug with the CLI's name. (#1806)
* Forward port the CLI tests from Flask-CLI.

* Make sure the parameter passed to the CLI's AppGroup is the app's name, not the app itself.
2016-05-16 19:36:55 +02:00
Steven Loria
2bf477cfea Add JSONIFY_MIMETYPE configuration variable (#1728)
Allow jsonify responses' mimetype to be configured
2016-04-08 15:30:47 -07:00
David Hou
9f1be8e795 Raise BadRequest if static file name is invalid
* Raise BadRequest if static file name is invalid

* Clean up syntax a bit

* Remove unnecessary close()
2016-04-02 21:07:27 +02:00
Shipeng Feng
cc536c8a7b Fixed stream_with_context if decorated function has parameters 2016-04-01 16:17:45 -07:00
Reuven
4dc2ef19ea Use pytest.raises() instead of try/catch with asser 0
This is somehow more readable, and enable using the features of pytest's ExeptionInfo (such as errisinstance).
2016-03-04 13:30:40 +02:00