Fantix King
a71c167836
fix teardown bug in FlaskClient
...
* Fixes pytest-dev/pytest-flask#42
2019-05-25 14:03:28 -07:00
David Lord
ed9ab2d3b6
strip static url trailing slash at assignment
2019-05-25 11:18:40 -07:00
Pete Beardmore
a12bf290da
fix 'static_url_path' defaulting for empty paths
...
-prefix a path delimiter iff there's a path to delimit
-ensures a valid default static route rule is created on application
intialisation for the case 'static_folder=""' and implicit
'static_url_path'
2019-05-25 07:03:36 -07:00
Anthony Plunkett
ec1ccd7530
Add Blueprint level cli command registration
...
Implements #1357 .
Adds ability to register click cli commands onto blueprint.
2019-05-24 14:43:29 -07:00
pgjones
7bf8366970
Allow dictionary return values as JSON
...
This supports an increasingly common usecase whereby JSON is the
primary response (rather than a templated string). Given Flask has a
short syntax for HTML reponses, it seems fitting that it should also
do so for JSON responses. In practice it allows,
@app.route("/")
def index():
return {
"api_stuff": "values",
}
2019-05-24 09:48:55 -07:00
Adarsh Sharma
db8cb31f2b
Fix #2937 : Ensure the consistency in load_dotenv's return type
2019-05-19 11:58:39 -07:00
vorelq
e1cc16f8be
Fix 0 port value being overriden by default
...
By explicitly comparing port value with None,
instead of using its bool() value.
2019-05-19 11:36:47 -07:00
Eruvanos
6af14f058b
support dataclass in JSONEncoder
2019-05-18 21:37:54 -07:00
Frankie Liu
2039e2e3b6
Remove ending slash from static_url_path
2019-05-18 21:23:14 -07:00
EtiennePelletier
8590d65a57
Use Werkzeug's JSONMixin class and update tests
...
Flask's JSONMixin class was moved to Werkzeug>=0.15
Co-authored-by: Jeffrey Eliasen <jeff@jke.net>
2019-05-18 20:57:26 -07:00
LeeW
1f3923a999
Inherit "methods" in MethodView
...
* Current behavior: If a base class inherits MethodView and child class
inherits without overwriting "methods". The "methods" defined in base
class would be ignored
* Fix: Inherit all the "methods" defined in base classes if "methods"
variable is not overwritten
2019-05-17 13:57:06 -07:00
David Lord
6f703a564c
clean up open_resource and tests
2019-05-17 13:23:27 -07:00
icreatedanaccount
ad709be46e
Allow mode='rt' on open_resource() helper
2019-05-17 13:22:13 -07:00
David Lord
05a4e15ee4
Merge branch '1.0.x'
2019-05-17 11:13:08 -07:00
David Lord
a4f0f19796
don't push app context for test client json
2019-05-17 09:00:08 -07:00
David Baumgold
025589ee76
Reformat with black
...
https://github.com/python/black
2019-05-06 16:28:58 -04:00
David Lord
a74864ec22
Merge remote-tracking branch 'origin/1.0-maintenance'
2019-01-07 10:00:10 -08:00
David Lord
662ce2151d
add changelog for GH-2986
2019-01-07 09:52:54 -08:00
Jimmy Jia
b92b2e6c74
Do not handle RoutingExceptions with app error handlers
2019-01-07 09:01:37 -08:00
garenchan
40118e785f
Make sure the attachment filename is text type.
...
If attachment filename is bytes type and contains non-ascii coded bytes,
then the following ASCII encoding process will trigger
UnicodeDecodeError exception.
Fix issue #2933 .
2019-01-07 07:17:33 -08:00
David Lord
366f3f49af
add changelog for GH-2957
2019-01-07 06:56:20 -08:00
Ignasi Bosch
b570bf699c
Allow partial content on bytesio
2019-01-07 06:17:36 -08:00
David Lord
4f3dbb3f3b
Merge branch '1.0-maintenance'
2019-01-06 16:33:17 -08:00
David Lord
a0ccc47780
clean up flask --version code
2019-01-06 16:24:05 -08:00
Matt Robenolt
25de45cbb6
Add support for PathLike objects in static file helpers
...
See: https://www.python.org/dev/peps/pep-0519/
This is mostly encountered with pathlib in python 3, but this API
suggests any PathLike object can be treated like a filepath with
`__fspath__` function.
2019-01-05 15:23:47 -08:00
David Lord
f7d50d4b67
Merge branch '1.0-maintenance'
2019-01-05 15:12:17 -08:00
David Lord
49efc44233
clear KeyError in production for Werkzeug 0.15
2019-01-05 12:49:59 -08:00
Jarek Piórkowski
9b0bd91195
Correct tests
...
We've discovered that passing Unicode in Host actually works, except for
test client limitations on Python 2 - and the only things that don't
work are non-printable characters.
2018-11-13 13:09:16 -05:00
Jarek Piórkowski
ed9775fb77
Handle errors during create_url_adapter
...
If create_url_adapter raises (which it can if werkzeug cannot bind
environment, for example on non-ASCII Host header), we handle it as
other routing exceptions rather than raising through.
ref https://github.com/pallets/werkzeug/issues/640
2018-11-12 16:59:09 -05:00
Dave Chevell
e08bcf9f97
Fix #2935 : Copy current session object in copy_current_request_context ( #2936 )
...
Add session to RequestContext.copy()
2018-11-03 20:32:24 -07:00
garenchan
c38499bbf2
ignore colon with slash when split app_import_path
...
Flask currently supports importing app through a combination of module
path and app variable name, such as '/usr/app.py:my_app'. When the
module path contains a colon, it will conflict with this import way and
a `flask.cli.NoAppException` will be raised.
A file path on a Windows system may contain a colon followed by a slash.
So we solved this problem on Windows by ignoring the colon followed by a
slash when we split app_import_path.
Fix issue #2961 .
2018-10-24 23:47:41 +08:00
ThiefMaster
161c43649d
Merge branch '1.0-maintenance'
2018-06-14 13:31:40 +02:00
ThiefMaster
50227f0954
Add option to not overwrite debug flag in cli
...
This is mainly intended for custom CLIs that may load a config file
which already sets the debug flag and does not make use of the `FLASK_*`
env vars at all.
2018-06-14 13:25:05 +02:00
Grey Li
4025e27b57
Add test for routes command when no routes registered
2018-05-31 11:43:51 +08:00
Dilan Coss
8fa3ed13bf
details fixed
2018-05-29 09:51:08 -06:00
Dilan Coss
8cdd01ea5d
Test added for _AppCtxGlobals __repr__ method
2018-05-28 23:49:06 -06:00
David Lord
b51ab3ff2c
encode filenames as ascii instead of latin-1
...
latin-1 is allowed by pep3333, but that breaks gunicorn
2018-05-28 06:36:47 -07:00
Briehan Lombaard
a913b4dafd
SSLContext was added in Python 2.7.9
2018-05-17 06:18:42 -07:00
David Lord
b21b4d1608
add more merge cases
2018-05-01 13:29:48 -07:00
Hsiaoming Yang
f7a3bdc6db
Fix blueprint route for ""
2018-05-01 14:35:55 +09:00
David Lord
5965cb7e1c
rename to FLASK_SKIP_DOTENV, add docs, test
2018-04-29 14:20:17 -07:00
David Lord
4c8ec8f555
Merge pull request #2739 from pallets/2735-abort-debug
...
Only trap key errors by default in debug, not all BadRequest errors
2018-04-28 07:01:42 -07:00
David Lord
b573a86977
trap key errors in debug, not all 400 errors
2018-04-28 06:51:08 -07:00
David Lord
4d0cdf95e6
merge slashes between blueprint prefix and rule
2018-04-27 12:40:06 -07:00
ThiefMaster
6663bf1f7d
Fix registering partials as view functions
2018-04-27 13:44:07 +02:00
Nick Pope
fc6a1d9354
Fix default index for TaggedJSONSerializer.register()
...
Change the default value of ``index`` to ``None`` in ``register()`` so
that it is possible to insert a new tag as the penultimate item in the
order list.
2018-04-19 14:16:11 +01:00
David Lord
1ed756a523
add Response.max_cookie_size config
2018-04-10 11:17:18 -07:00
David Lord
ab4142215d
detect UTF encodings when loading json
2018-04-10 09:34:59 -07:00
fphonor
171eb28c95
get_json separate cache depending on silent arg
2018-04-09 02:52:40 -07:00
David Lord
5f42989ce3
don't use Flask(__name__) in conftest
2018-02-28 06:50:49 -08:00
David Lord
401423df06
only strip one slash when registering blueprint
...
add test and changelog
2018-02-23 15:47:06 -08:00
David Lord
82f0d120de
use subdomain arg in url_map.bind_to_environ
...
rename new subdomain test, parametrize
test allowing subdomains as well as ips
add subdomain_matching param to docs
add some references to docs
add version changed to create_url_adapter
2018-02-23 08:39:31 -08:00
Armin Ronacher
8cec2010c0
Do not enable subdomain matching by default
...
Updated tests for new subdomain matching
Added a test to validate matching behavior
2018-02-23 07:53:27 -08:00
David Lord
cf5525f98a
add test_cli_runner for testing app.cli commands
2018-02-19 15:34:46 -08:00
David Lord
310fbfcf64
revert copyright year to project start
...
add copyright header to files
2018-02-08 12:43:30 -08:00
David Lord
03a2996bb8
Merge pull request #2530 from pallets/feature/factory-detection
...
Improved bad factory error handling
2018-01-28 11:27:07 -08:00
David Lord
e21abd9da5
Merge pull request #2607 from FadhelC/SameSite-cookie-feature
...
Added support for cookie SameSite attribute
2018-01-23 15:20:16 -08:00
David Lord
382b13581e
clean up samesite docs
2018-01-23 15:11:50 -08:00
David Lord
2beedabaaf
add HTTPS support for flask run command
2018-01-23 10:03:53 -08:00
Fadhel_Chaabane
a1d9ebe4ab
New Feature: Added Support for cookie's SameSite attribute.
2018-01-23 13:57:50 +00:00
David Lord
8bdf820e9b
reset standard os env after each test
2018-01-10 13:53:45 -08:00
Armin Ronacher
2433522d29
Add Support for FLASK_ENV ( #2570 )
...
This introduces environments to Flask
2018-01-06 17:07:56 +01:00
David Lord
0a33954555
improve documentation for session attributes
...
add test for session attributes
2018-01-04 12:56:18 -08:00
David Lord
604cc758fb
use config fixture, get plugin via unregister
2017-12-14 12:20:03 -08:00
Camilo
33fa580947
restore the logging plugin only if it was active to begin with
2017-12-14 09:40:34 -05:00
Camilo
e30c39fe78
fix non-passing tests for logging on pytest > 3.3.0
2017-12-14 01:55:22 -05:00
Adrian Moennich
777cc17de3
Fix broken test
2017-11-25 00:53:43 +01:00
Adrian Moennich
eb1c2faf9f
Merge remote-tracking branch 'upstream/0.12-maintenance'
2017-11-25 00:44:07 +01:00
ThiefMaster
c52e1b7388
Fix ValueError for some invalid Range requests
...
fixes #2526
2017-11-25 00:37:49 +01:00
Armin Ronacher
c23a63a185
Improved bad factory error handling
2017-11-25 00:05:57 +01:00
David Lord
5436dddf64
rewrite cli errors
...
consistent order for arguments to load functions
refactor find_app_by_string to flow better
more cli loader tests
2017-10-10 07:04:53 -07:00
Caratpine
2f57a0b917
Blueprint view function name should not contain dots
2017-10-09 08:12:34 -07:00
Chuan Ma
5888d76342
pytest.yield_fixture deprecated in pytest 3.0+.
...
It's suggested to use pytest.fixture directly,
and flask already requires 'pytest>=3'.
2017-08-14 10:25:24 -04:00
David Lord
66b1b752da
simplify logging configuration
...
single default handler and formatter
don't remove handlers
configure level once using setLevel
document logging
reorganize logging tests
2017-07-31 12:49:03 -07:00
David Lord
a89bdb3395
prefer the url's scheme over the kwarg
...
tabs -> spaces
add test
add changelog
2017-07-29 13:03:08 -07:00
David Lord
491d331e6e
load env vars using python-dotenv
2017-07-16 13:37:51 -07:00
David Lord
fb845b9032
allow local packages in FLASK_APP
...
don't require .py extension in FLASK_APP
add tests for nested package loading
parametrize cli loading tests
2017-07-14 19:49:05 -07:00
David Lord
59f7966e31
support passing environ to test client ( #2412 )
...
closes #2411
2017-07-13 08:42:53 -07:00
David Lord
9560f22bb6
clean up
2017-07-10 07:10:47 -07:00
Bijan Vakili
a417e41d27
Update documentation and regression tests to clarify that Flask.teardown_appcontext() only receives unhandled exceptions
2017-07-07 17:34:44 -07:00
William Horton
5909e26fba
Remove unused import from test_basic ( #2403 )
2017-06-30 17:28:48 +02:00
David Lord
465922e5f1
clean up secret key docs
...
consistent key across docs and examples
consistent key across tests, set in conftest
2017-06-28 07:58:06 -07:00
David Lord
5bc0d15359
un-deprecate request.json
2017-06-26 09:34:26 -07:00
David Lord
715a9a3e7b
remove deprecated flask.ext
2017-06-26 08:47:28 -07:00
David Lord
723e665004
remove deprecated Request.module
2017-06-26 07:46:33 -07:00
David Lord
d63c2bc417
remove deprecated Flask.static_path
2017-06-26 07:45:29 -07:00
David Lord
448368e226
style cleanup
...
[ci skip]
2017-06-16 06:59:37 -07:00
Miguel Grinberg
7c40aa9e50
Import app from wsgi.py or app.py if FLASK_APP is not defined
...
Fixes #2376
2017-06-15 11:27:50 -07:00
Eugene M. Kim
63ccdada1b
Actually hand-spin and use a tzinfo subclass
...
This is for Python 2.x compatibility.
Suggested-by: David Lord <davidism@gmail.com>
2017-06-14 14:23:13 -07:00
Eugene M. Kim
f803760275
Re-revert to not using pytz
...
Will spin a tzinfo subclass.
2017-06-14 14:14:18 -07:00
Eugene M. Kim
34050630d6
Skip aware datetime tests if pytz is unavailable
2017-06-14 14:08:42 -07:00
Eugene M. Kim
eb9618347c
Use pytz again for tests
...
This is because datetime.timezone is Python 3 only. The only
alternative would be to hand-spin a datetime.tzinfo subclass, an
overkill.
This reverts commit 0e6cab3576
.
2017-06-14 13:57:40 -07:00
Eugene M. Kim
5b38fe2fbe
Merge branch 'master' of github.com:pallets/flask into json_encode_non_utc_datetimes
2017-06-14 13:11:53 -07:00
Eugene M. Kim
0e6cab3576
Rewrite test_jsonify_aware_datetimes without pytz
2017-06-14 13:06:26 -07:00
David Lord
4d2a3ab2e0
test no debug flag doesn't reconfigure
...
test templates_auto_reload property instead of config
use app fixture in test
2017-06-14 12:31:56 -07:00
Eugene M. Kim
d75d83defd
Add UTs for #2372
...
test_encode_aware_datetime() fails for non-UTC timezones due to the bug.
2017-06-14 12:22:09 -07:00
David Lord
9e39c506e0
Merge branch 'master' into reload_templates_run_debug
2017-06-14 09:58:33 -07:00
David Lord
5c12acefbb
failing test
2017-06-05 06:14:13 -07:00
David Lord
e97253e4c1
clean up JSON code and docs
2017-06-04 11:44:00 -07:00
David Lord
dbc70c9274
Merge remote-tracking branch 'remotes/origin/master' into json-mixin
2017-06-04 09:42:39 -07:00
David Lord
5978a0f55f
failing test for streaming session
2017-06-02 11:07:53 -07:00
David Lord
fd8b95952c
add tests for flask.json.tag
2017-06-02 10:01:30 -07:00
David Lord
ea2e9609bc
Merge branch 'master' into json-object-hook
2017-06-01 06:40:27 -07:00
David Lord
859d9a9d5c
show nice message when registering error handler for unknown code
...
clean up error handler docs
closes #1837
2017-05-31 18:04:08 -07:00
David Lord
42905b8a55
set description for trap as well as debug
...
test for key error description
2017-05-29 19:41:07 -07:00
David Lord
045dccaefb
make debugging bad key errors easier
...
* TRAP_BAD_REQUEST_ERRORS is enabled by default in debug mode
* BadRequestKeyError has the key in the description in debug mode
closes #382
2017-05-29 19:08:25 -07:00
David Lord
b8eba0a3fa
use existing response.vary property to set vary header
...
closes #2345
2017-05-29 10:09:24 -07:00
David Lord
a37f675ccb
Merge remote-tracking branch 'origin/0.10-maintenance'
...
refactor make_test_environ_builder
2017-05-28 07:25:15 -07:00
Kenneth Reitz
090109b637
Merge pull request #2326 from HndrkMkt/#2264-handle-app-factory-in-FLASK_APP
...
Handle app factory with arguments in FLASK_APP
2017-05-25 14:57:17 -07:00
Kenneth Reitz
d911c897ee
Merge branch 'master' into master
2017-05-25 14:22:53 -07:00
Hendrik Makait
48c2925664
Factor in code review comments and refactor functions to be more naturally split.
2017-05-25 11:28:20 -07:00
Hendrik Makait
7106fb6357
Handle app factory with arguments in FLASK_APP
2017-05-25 10:11:42 -07:00
Nina Zakharenko
e7cd68ba58
Don't overwrite Vary header when setting for cookie access #2317
2017-05-24 20:05:11 -07:00
Christian Stade-Schuldt
4ec1fbc9f5
More DRYing up the test suite ( #2325 )
2017-05-24 17:27:36 -07:00
David Lord
c62b614d9c
Merge pull request #2324 from rzelayafavila/2313-refactor-gevent-tests-into-class
...
Fix for Issue 2313 - refactoring gevent tests into class
2017-05-23 17:31:44 -07:00
David Lord
849fc4b90c
Merge pull request #2323 from dawran6/test-fixture
...
Cleanup test_blueprint.py to use test fixtures
2017-05-23 17:14:57 -07:00
Rene A. Zelaya
d29dbe14cf
Correcting name of GreenletContextCopying test class (to start with 'Test'), making it extend object, and also having the test methods in it include 'self' as first argument.
2017-05-23 16:51:50 -07:00
Rene A. Zelaya
f40617029a
Merge remote-tracking branch 'pallets/master' into 2313-refactor-gevent-tests-into-class
2017-05-23 16:45:47 -07:00
Rene A. Zelaya
2eb28165a9
Bundling 'test_greenlet_context_copying' functions into a new class in tests/test_reqctx.py.
2017-05-23 16:45:11 -07:00
Randy Liou
c03a82713a
Cleanup test_blueprint.py to use test fixtures
...
Modify several tests to use the app and client test fixtures.
2017-05-23 16:42:14 -07:00
Randy Liou
3fce4898f8
Add test for Blueprint app-wide url processing
...
The test add coverage for methods: Blueprint.app_url_defaults, and
Blueprint.app_url_preprocessing. This PR increases the coverage of
blueprint module by 2%.
2017-05-23 16:26:53 -07:00
David Lord
39f7aaa416
Merge pull request #2319 from HndrkMkt/#2266-support-create-app-without-script-info
...
Support `create_app` without script_info or with script_info as named argument
2017-05-23 16:24:29 -07:00
Christian Stade-Schuldt
5b0b9717da
DRYing up the test suite using pytest fixtures ( #2306 )
...
* add fixtures to conftest.py
* use fixtures in test_appctx.py
* use fixtures in test_blueprints.py
* use fixtures in test_depreciations.py
* use fixtures in test_regressions.py
* use fixtures in test_reqctx.py
* use fixtures in test_templating.py
* use fixtures in test_user_error_handler.py
* use fixtures in test_views.py
* use fixtures in test_basics.py
* use fixtures in test_helpers.py
* use fixtures in test_testing.py
* update conftest.py
* make docstrings PEP-257 compliant
* cleanup
* switch dictonary format
* use pytest parameterization for test_json_as_unicode
2017-05-23 15:18:39 -07:00
Hendrik Makait
ae41df9a77
Check if app factory takes script_info argument and call it with(out) script_info as an argument depending on that
2017-05-23 13:48:42 -07:00
David Lord
ce813ae521
Merge pull request #2316 from ka7eh/automatic-options-in-views
...
Adds provide_automatic_options to Class-based Views
2017-05-23 12:46:31 -07:00
David Lord
a037762781
Merge pull request #2311 from bovarysme/use-yield-syntax
...
Use the yield syntax in pytest's fixtures
2017-05-23 12:00:34 -07:00
kaveh
75f537fb87
Adds provide_automatic_options to Class-based Views
2017-05-23 11:51:13 -07:00
cerickson
4f815015b8
Added support for generic HTTPException handlers on app and blueprints
...
Error handlers are now returned in order of blueprint:code, app:code,
blueprint:HTTPException, app:HTTPException, None
Corresponding tests also added.
Ref issue #941 , pr #1383 , #2082 , #2144
2017-05-23 10:45:42 -07:00
Florian Sachs
668061a5fc
Register errorhandlers for Exceptions
...
Allow a default errorhandler by registering
an errorhandler for HTTPException
tests included
2017-05-23 10:34:31 -07:00
bovarysme
5963cb5a51
Use the yield syntax in pytest's fixtures
2017-05-23 18:21:29 +02:00
David Lord
c8e56d5807
Merge pull request #2303 from MikeTheReader/master
...
Added tests for make_response and get_debug_flag to improve coverage of helpers.py
2017-05-23 08:34:22 -07:00
MikeTheReader
7c882a457b
Replace double quotes with single quotes
2017-05-23 07:59:53 -07:00
MikeTheReader
cd412b20dc
Parameterize test_get_debug_flag
2017-05-23 07:51:57 -07:00
MikeTheReader
fd4a363657
Modifications based on review
2017-05-22 20:49:37 -07:00
Randy Liou
d8d712a0de
Add coverage for Blueprint teardown request method
...
Test the following methods in the Blueprint object: teardown_request,
and teardown_app_request.
This PR increases the coverage of blueprint module by 3%.
2017-05-22 16:58:04 -07:00
Randy Liou
a690ae27a3
Add coverage for Blueprint request process methods
...
Add test to cover following methodss to the Blueprint object:
before_request, after_request, before_app_request,
before_app_first_request, after_app_request.
This PR increases the coverage of flask.blueprints by 6%.
2017-05-22 16:58:04 -07:00
MikeTheReader
6f49089a62
Added tests for make_response and get_debug_flag to improve coverage of helpers.py
2017-05-22 16:15:48 -07:00
David Lord
0c94908956
Merge pull request #2297 from HndrkMkt/#2265-auto-detect-create-app-function
...
Auto-detect create_app() in find_best_app() #2265
2017-05-22 16:13:27 -07:00
Randy Liou
7ce01ab9b4
Add coverage for Blueprint.add_app_template_global
...
This tests the Blueprint.add_app_template_global mothod, which internally
calls the Blueprint.app_template_global method. The methods are used to
registering a function to the jinja template environment.
This PR increases the test coverage for module flask.blueprint by 4%.
2017-05-22 14:33:58 -07:00
David Lord
e706b5e544
Merge pull request #2298 from dawran6/test-bp-context
...
Add coverage for Blueprints.(app_)context_processor
2017-05-22 14:01:59 -07:00
Randy Liou
136dbf7de0
Add coverage for Blueprints.(app_)context_processor
...
Test both context_processor and app_context_processor functions.
Two context parameters are added into the context: one added to
the blueprint locally; another added to the app globally. The test
asserts the behaviors in both blueprint scope and the app scope.
The coverage for flask.blueprints is increased by 3%.
2017-05-22 13:09:22 -07:00
Hendrik Makait
ced719ea18
Auto-detect create_app and make_app factory functions
2017-05-22 12:30:18 -07:00
Randy Liou
9fddecd4d9
Add coverage for Blueprint.app_errorhandler
...
This test case registers an application-wise error handler from
a Blueprint. Verifies the error handler by aborting the flask app
from the application itself as well as from another registered
Blueprint.
2017-05-22 12:00:04 -07:00
David Lord
5d9dd0b379
set session accessed for setdefault
2017-05-20 13:00:17 -07:00
David Lord
e2f4c0ac16
Merge branch 'master' into vary-cookies
2017-05-19 09:44:06 -07:00
David Lord
f7c35bf0d5
safe_join on Windows uses posixpath
...
fixes #2033
closes #2059
2017-05-16 08:34:37 +02:00
David Lord
2a65794306
safe_join on Windows uses posixpath
...
fixes #2033
closes #2059
2017-05-15 16:58:01 -07:00
David Lord
f75ad9fca2
refactor session cookie domain logic
...
cache result of session cookie domain
add warnings for session cookie domain issues
add changelog
2017-05-13 21:59:00 -07:00
David Lord
7ad79583b9
add sort by match order
...
sort by endpoint by default
combine sort flags
sort methods
ignore HEAD and OPTIONS methods by default
rearrange columns
use format to build row format string
rework tests
add changelog
2017-04-26 10:26:59 -07:00
David Lord
717e45ab15
Merge branch 'master' into routes-command
2017-04-25 13:13:10 -07:00
David Lord
697f7b9365
refactor make_response to be easier to follow
...
* be explicit about how tuples are unpacked
* allow bytes for status value
* allow Headers for headers value
* use TypeError instead of ValueError
* errors are more descriptive
* document that view must not return None
* update documentation about return values
* test more response types
* test error messages
closes #1676
2017-04-25 08:30:48 -07:00
David Lord
46f83665ef
clean up blueprint json support
...
add changelog for #1898
2017-04-24 10:16:50 -07:00
David Lord
74b3f7e04c
Merge pull request #1898 from RaHus/per_blueprint_jsoncoding_#1710
...
Per blueprint jsoncoding #1710
2017-04-24 10:16:20 -07:00
David Lord
13754b6d11
ensure error while opening session pops context
...
errors will be handled by the app error handlers
closes #1538 , closes #1528
2017-04-22 13:57:04 -07:00
David Lord
0d9d3d8f92
Merge branch 'master' into figome-multiple-inheritance
2017-04-21 10:33:29 -07:00
David Lord
97e2cd0a5a
update changelog
...
move test next to existing test, rename
reword / reflow param doc
2017-04-21 07:26:30 -07:00
David Lord
8ad4f476aa
Merge branch 'master' into jrmccarthy-master
2017-04-21 07:03:46 -07:00
David Lord
e50767cfca
add test for build error special values
2017-04-20 08:52:37 -07:00
David Lord
f0c714a01b
Merge pull request #1886 from dawran6/test_bp_endpoint_dec
...
Enhance code coverage for Blueprint.endpoint
2017-04-14 09:22:12 -07:00
David Lord
4ff84d537a
get mtime in utc
2017-04-14 05:30:03 -07:00
David Lord
bf6910a639
get mtime in utc
2017-04-13 14:55:56 -07:00
David Lord
8b45009dbc
Merge pull request #2223 from antlarr/master
...
Fix send_file's attachment_filename to work with non-ascii filenames
2017-04-08 10:54:20 -07:00
David Lord
f790ab7177
need to test against raw header
...
parsing prefers the last value parsed for the option
2017-04-08 10:33:06 -07:00
David Lord
c1973016ea
style cleanup
...
break out header parts in test
test for no filename* parameter for ascii header
2017-04-07 18:02:31 -07:00
jab
00d6e339ec
Change Flask.__init__ to accept two new keyword arguments, host_matching and static_host. ( #1560 )
...
This enables host_matching to be set properly by the time the constructor adds
the static route, and enables the static route to be properly associated with
the required host.
Previously, you could only enable host_matching once your app was already
instantiated (e.g. app.url_map.host_matching = True), but at that point
the constructor would have already added the static route without host matching
and an associated host, leaving the static route in a broken state.
Fixes #1559 .
2017-04-07 16:31:54 +02:00
Markus Unterwaditzer
de555c82ce
Merge branch '0.12-maintenance'
2017-03-31 18:44:33 +02:00
Markus Unterwaditzer
c935eaceaf
Revert "Handle BaseExceptions ( #2222 )"
...
This reverts commit 1d4448abe3
.
2017-03-31 18:44:14 +02: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
Diggory Blake
1d4448abe3
Handle BaseExceptions ( #2222 )
...
* Handle BaseExceptions
* Add test and changes
* Make test more idiomatic
2017-03-31 18:07:43 +02:00
Antonio Larrosa
6ef45f30ab
Fix previous commits to work with python 2 and python 3
...
Also, parse_options_header seems to interpret filename* so we better
test the actual value used in the headers (and since it's valid
in any order, use a set to compare)
2017-03-24 20:05:01 +01:00
Antonio Larrosa
0049922f2e
Fix send_file to work with non-ascii filenames
...
This commit implements https://tools.ietf.org/html/rfc2231#section-4 in
order to support sending unicode characters. Tested on both Firefox and
Chromium under Linux.
This adds unidecode as a dependency, which might be relaxed by using
.encode('latin-1', 'ignore') but wouldn't be as useful.
Also, added a test for the correct headers to be added.
Previously, using a filename parameter to send_file with unicode characters, it
failed with the next error since HTTP headers don't allow non latin-1 characters.
Error on request:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 193, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 186, in execute
write(b'')
File "/usr/lib/python3.6/site-packages/werkzeug/serving.py", line 152, in write
self.send_header(key, value)
File "/usr/lib64/python3.6/http/server.py", line 509, in send_header
("%s: %s\r\n" % (keyword, value)).encode('latin-1', 'strict'))
UnicodeEncodeError: 'latin-1' codec can't encode character '\uff0f' in position 58: ordinal not in range(256)
Fixes #1286
2017-03-23 17:30:48 +01:00
Ed Brannin
6e5250ab5d
Fix CLI test for ImportError -> NoAppException
2017-03-21 16:17:09 -04:00
Sven-Hendrik Haase
ed17bc1710
Add test to showcase that printing a traceback works
2017-03-16 20:56:12 +01:00
Hsiaoming Yang
a7f1a21c12
Don't rely on X-Requested-With for pretty print json response ( #2193 )
...
* Don't rely on X-Requested-With for pretty print json response
* Fix test cases for pretty print json patch
* Fix gramma error in docs for pretty print json config
* Add changelog for JSONIFY_PRETTYPRINT_REGULAR
2017-03-07 10:09:46 +09:00
Josh Rowe
8a8a608152
Move object_hook outside loads method so class can be extend and reused
2017-02-23 15:25:52 +00:00
David Lord
42fbbb4cbb
add test and changelog for SERVER_NAME app.run default
...
ref #2152
2017-01-17 14:08:33 -08:00
Andrew Arendt
01b992b1a1
Added python3.6 support for tests
2017-01-10 11:20:53 -06: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
Adam Byrtek
ca547f0ec3
JSON response tests and first draft of code that passes
2016-08-19 21:14:12 +02:00
Adam Byrtek
6c5ef2bc5c
Use `content_type` kwarg instead of manipulating headers
2016-08-19 21:13:33 +02:00
Adam Byrtek
c4139e0e5d
JSON support for the Flask test client
2016-08-19 21:13:33 +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
Antoine Catton
516ce59f95
Add the ability to combine MethodViews
2016-06-28 17:35:39 +02:00
Kiss György
1b764cff93
Added runner fixture
2016-06-25 13:24:43 +02:00
Kiss György
b8e826c16b
Added tests, fixed some minor alignment problems.
2016-06-25 13:22:18 +02:00
Dave Barker
1a67e284d0
Remove unnecessary werkzeug mock attribs from test
2016-06-15 02:25:48 +01:00
Dave Barker
24289e97af
Add test for new template auto reload debug behaviour
2016-06-15 02:15:33 +01:00
RamiC
4305ebdf66
Check for a request ctx before using the request.
...
Use the app json coder when blueprint json coder is set to none.
Revert the failling test to using an app_context
re #1710
2016-06-08 12:58:56 +03:00
RamiC
501b8590dd
Allow per blueprint json encoder decoder
...
re #1710
2016-06-08 12:03:26 +03: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
Randy Liou
954b7ef7bb
Enhance code coverage for Blueprint.endpoint
...
Add basic test for the endpoint decorator for the Blueprint object.
2016-06-03 16:02:45 -07: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
David Lord
7b1ebfbc4d
Merge pull request #1679 from miguelgrinberg/passthrough-errors
...
Werkzeug should not block propagated exceptions from Flask
2016-01-25 22:17:04 -08:00
Jeff Widman
daceb3e3a0
Add support for serializing top-level arrays to JSON
...
Fix #170 , #248 , #510 , #673 , #1177
2016-01-13 13:20:11 -08:00
Miguel Grinberg
952a6c8989
Werkzeug should not block propagated exceptions from Flask
2016-01-02 14:18:36 -08:00
Timo Furrer
d526932a09
support timedelta for SEND_FILE_MAX_AGE_DEFAULT config variable
2015-10-24 07:04:23 +02:00
Jimmy McCarthy
04a3eeee3b
Merge branch 'master' of github.com:mitsuhiko/flask
2015-09-14 13:06:54 -05:00
Markus Unterwaditzer
81ae94a5fd
Merge branch '0.10-maintenance'
2015-07-16 12:05:07 +02:00
Jimmy McCarthy
011b129b6b
Add kwarg to disable auto OPTIONS on add_url_rule
...
Adds support for a kwarg `provide_automatic_options` on `add_url_rule`, which
lets you turn off the automatic OPTIONS response on a per-URL basis even if
your view functions are functions, not classes (so you can't provide attrs
on them).
2015-07-07 13:20:53 -05:00
Alan Hamlett
99c99c4c16
Enable autoescape for `render_template_string`
2015-07-04 23:41:43 +02:00
ThiefMaster
bbaf20de7c
Add pop and setdefault to AppCtxGlobals
2015-06-20 18:04:58 +02:00
Alexander Pantyukhin
5e12748d0e
Ignore before_render_template return values
2015-06-17 15:42:39 +02:00
Alexander Pantyukhin
eae37b575d
fix test_signals
2015-06-17 15:42:39 +02:00
Alexander Pantyukhin
e57199e0c4
fix test_signals
2015-06-17 15:42:39 +02:00
Alexander Pantyukhin
967907ee81
before_render_template signal can override render template.
2015-06-17 15:42:39 +02:00
Alexander Pantyukhin
1fbeb337c4
fix endline in the signal.py
2015-06-17 15:42:39 +02:00
Alexander Pantyukhin
d53d5c732b
before_render_template signal
2015-06-17 15:42:39 +02:00
Markus Unterwaditzer
d13a1b363e
Rename jinja_env_class
...
Inspired by #1056
2015-06-06 06:29:26 +02:00
Markus Unterwaditzer
d00f5cc9fe
Merge branch 'ThiefMaster-override-jinja-env'
2015-06-06 03:30:49 +02:00