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
Joshua Carp
348bf52188
Handle empty deque on errorhandler lookup.
...
After registering a custom errorhandler by exception class, raising any
unhandled exception in a view function swallows the error and instead
throws an `IndexError` on trying to look up the appropriate handler.
This patch avoids the uninformative `IndexError` and preserves the
original exception by looping until the deque of classes is empty, not
forever.
2015-06-02 16:13:30 -04:00
Markus Unterwaditzer
0bac2ade91
Fix formatting errors
2015-04-11 20:52:47 +02:00
Phil Schaf
fd8e6b26f9
removed ExceptionHandlerDict
2015-04-11 14:05:22 +02:00
ThiefMaster
08ac3aa4e3
Allow custom jinja environments
...
This is useful e.g. when using the new Jinja Environment
attributes added in mitsuhiko/jinja2#404
2015-04-06 15:03:00 +02:00
Brandon Sandrowicz
20f62e828b
Fix Possible Typo
...
Looks like that was meant to be `config_key`. It works by accident because the function is defined in the same scope as the look that passes `config_key` to `apprunner`.
2015-04-02 01:48:48 +02:00
Markus Unterwaditzer
1577e1386e
Revert "Don't use threads in this test"
...
This reverts commit 78cd4161f0
.
2015-03-29 23:03:38 +02:00
Markus Unterwaditzer
78cd4161f0
Don't use threads in this test
...
I think test failures would've been ignored if there were some.
Fixes #1401
2015-03-29 13:40:35 +02:00
Markus Unterwaditzer
33bad011c3
Merge branch 'mjpieters-appcontext_ignore_handled_exception'
2015-03-23 16:44:32 +01:00
Martijn Pieters
ec0d208bc1
Switch away from using None as default value for the exception when tearing down a context.
...
When an exception has been handled when using the request / app context in a with statement, `sys.exc_info()` will still contain the exception information even though it has been handled already. The `__exit__` methods pass in `None` for the exception value in that case, which needs to be distinguisable from the default value for the `exc` parameter. Use a dedicated singleton sentinel value instead.
2015-03-23 15:17:19 +00:00
Markus Unterwaditzer
1aa8a54b17
Always run memory tests
2015-03-22 12:49:47 +01:00
Keyan Pishdadian
1cd9e91810
Changed error message to include actual exception contents
2015-03-05 13:04:38 -05:00
Keyan Pishdadian
d6a1307f9d
Change strings to bytes to support Python3, typo in function name
2015-03-04 15:14:43 -05:00
Keyan Pishdadian
294961e6fc
Change tests to support older response format
2015-03-04 14:48:08 -05:00
Keyan Pishdadian
39e66ca6d7
Add tests for adding exception to response contents only when DEBUG is True
2015-03-04 14:40:16 -05:00
Chris Rebert
6d2c076a3b
make test_request_preprocessing_early_return more thorough
2015-02-06 13:11:23 -08:00
Markus Unterwaditzer
1158e22958
Fix test under Python 3
2015-02-06 18:20:17 +01:00
Markus Unterwaditzer
5fa76f6800
Add testcase for behavior described in #1338
2015-02-05 22:13:19 +01:00
Ben Jones
61263e08f9
Add datetime.date support to JSONEncoder
2015-01-23 07:44:17 -06:00
Parkayun
33534bb4a9
Happy New Year 2015
2015-01-02 11:35:00 +09:00
Michael Hall
98b155c65d
Fixed #1288 : app.add_url_rule() should look for OPTIONS methods in a case-insensitive manner
2014-12-26 08:58:35 -05:00
Marc Abramowitz
d9402fc0c0
Make `jsonify` terminate responses with a newline
...
This came up in the context of
https://github.com/kennethreitz/httpbin/issues/168
2014-12-07 14:37:26 -08:00
Markus Unterwaditzer
a1b273658d
Merge pull request #1222 from defuz/templates_auto_reload-eq-none
...
Set TEMPLATE_AUTO_RELOAD default value to None
2014-11-02 20:46:48 +01:00
Petr Zemek
ec3d5800f2
Put two spaces before inline comments when there is only one space.
...
PEP8 (E261) suggests to use at least two spaces before inline comments.
2014-10-27 11:24:15 +01:00
Petr Zemek
4840fc0edc
Change `== None` to `is None`.
...
PEP8 (E711) suggests that comparison to None should be `cond is None`.
2014-10-27 11:17:49 +01:00
Petr Zemek
e41bf1e181
Remove two redundant empty lines.
...
PEP8 suggests to use two empty lines to separate functions, not three.
2014-10-27 11:13:03 +01:00
defuz
f88765d504
set TEMPLATE_AUTO_RELOAD default value to None
2014-10-26 18:28:12 +03:00
defuz
5e8d503098
add tests for trim_namespace argument of app.config.get_namespace
2014-10-24 13:11:10 +04:00
Markus Unterwaditzer
bd232e5c82
PEP8
2014-10-21 19:11:54 +02:00
Gilman Callsen
d425279650
Improve compression by removing whitespace from separators when using jsonify() and JSONIFY_PRETTYPRINT_REGULAR is False.
...
Commit includes Changelog entry and two new tests in test_basic.py.
2014-10-21 19:11:06 +02:00
INADA Naoki
4d4a639ba4
Add test for deprecated flask.Request properties.
2014-10-15 03:32:04 +09:00
Davide Ceretti
93c190a8fd
Add unittest for appcontext_tearing_down signal
2014-10-07 07:34:19 +01:00
Markus Unterwaditzer
c6795eb626
Remove useless unittest imports
2014-09-21 16:47:38 +02:00
Paulo Bu
3f67fe94f1
Adds 2 tests for Flask.run method
2014-09-14 17:27:19 +02:00
Markus Unterwaditzer
192da325f8
Testsuite is not a package
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
56db3ddf4e
Remove useless imports
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
be42d5665e
Split instance tests off into own file
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
a4931ff3a7
Kill class in test_basic
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
71dae37733
Kill classes in test_regression
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
f8a778deae
Kill classes in test_testing
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
77d887526d
Rename fixture apps_tmpdir
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
a00ccdce94
Remove more test_apps
2014-09-11 22:09:52 +02:00
Markus Unterwaditzer
b88a837674
Remove fake extensions from test_apps
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
4ea4ea7f93
Remove old helper function
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
861aa0db1f
Init global test_apps explicitly
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
588cfa9c91
Add note to memleak tests
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
03339501ab
Remove obsolete apps
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
af4cb0ff2b
Remove flask superclass
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
af41dbe0c4
Remove useless classes
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
d0cf5ef394
WIP
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
e77bc2d86c
Remove class from test_views
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
7e8f1053bb
Fix assertion error
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
5da2c00419
Rewrite assertion methods
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
dd6b2574c9
Rework test_signals
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
b1c0951ad6
Move fixtures
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
ba82bac3d8
Rework test_config
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
df711eac90
Some fixes
2014-09-11 22:09:51 +02:00
Markus Unterwaditzer
8fa5e32d9a
Tests pass now.
2014-09-11 22:09:50 +02:00
Markus Unterwaditzer
961db8ad72
Made tests recognizable
2014-09-11 22:09:50 +02:00
Markus Unterwaditzer
3550b26071
Move tests
2014-09-11 22:09:50 +02:00
Armin Ronacher
4cb6eea8f1
Split up testsuite and moved it to flask.testsuite. This fixes #246
2011-08-26 11:21:26 +01:00
Armin Ronacher
ef0f626f0a
Added flask.views.View.decorators to automatically decorate class based views.
2011-08-25 22:09:48 +01:00
Armin Ronacher
485a6c332b
Moved testcase for test client context binding to the TestToolsTestCase
2011-08-25 20:49:53 +01:00
Armin Ronacher
8dbd71ef8e
Added a testcase where SERVER_NAME and APPLICATION_ROOT are not set
2011-08-25 20:48:38 +01:00
Armin Ronacher
e853a0f739
The test client and test_request_context are now both using the same logic internally for creating the environ. Also they use APPLICATION_ROOT now.
2011-08-25 20:47:50 +01:00
Armin Ronacher
f051939d8b
Test that we're not leaking a request context in the testsuite, fixed a leak
2011-08-25 15:24:10 +01:00
Armin Ronacher
001a5128d8
Refactored tests to use a different subclass
2011-08-25 15:20:40 +01:00
Armin Ronacher
a5da2c98f3
Implemented flask.testing.TestClient.session_transaction for quick session modifications in test environments.
2011-08-25 15:18:39 +01:00
Armin Ronacher
c844d02f1c
Added the APPLICATION_ROOT configuration variable which is used by session backends.
2011-08-25 12:13:55 +01:00
Armin Ronacher
eb9a14e158
Split up a test into two
2011-08-10 23:40:53 +02:00
Armin Ronacher
b3aaf6d5ca
Refactored package finding
2011-08-10 23:19:33 +02:00
Armin Ronacher
fb1a6730cf
Leave eggs when finding the instance path
2011-08-10 18:00:16 +02:00
Armin Ronacher
e328eba97c
Corrected prefix detection
2011-08-10 17:51:24 +02:00
Armin Ronacher
175d43b2f9
Instance paths are now moved into virtualenv/share/appname-instance if installed
2011-08-10 17:46:20 +02:00
Armin Ronacher
153ecbc920
Implemented instance paths
2011-08-10 13:34:58 +02:00
Armin Ronacher
6847329134
Flask will now give you an error in debug mode if a post request caused a redirect by the routing system.
2011-08-09 14:51:06 +02:00
Armin Ronacher
ce70131975
If JSON parsing fails it now issues a BadRequest exception.
2011-08-08 21:47:26 +02:00
Armin Ronacher
acac64e36a
Don't only catch BadRequest key errors but all bad request errors.
2011-08-08 21:46:53 +02:00
Armin Ronacher
02a1317460
Added the ability to trigger functions before the first request to the application
2011-08-07 12:43:38 +02:00
Armin Ronacher
5500986971
Flask in debug mode will now complain if views are attached after the first view was handled.
2011-08-07 02:30:34 +02:00
Armin Ronacher
f3db68c8ce
Added testcase for the debug behavior and explicit encoding
2011-08-05 16:56:43 +02:00
Armin Ronacher
7155f11a72
Added HTTP exception trapping. This should fix #294
2011-08-05 12:35:41 +02:00
Armin Ronacher
fafcc02f26
Added a testcase for 404 errors caused by the routing system
2011-08-04 16:44:42 +02:00
Armin Ronacher
c9a2ad2b8d
Fixed a bug in list_templates
2011-07-16 01:16:29 +02:00
Armin Ronacher
3b31df81ae
View functions can opt out of the default OPTIONS implementation
2011-07-14 14:18:42 +02:00
Armin Ronacher
bd473c1587
Fixed an issue that broke url processors for blueprints. Added testcases
2011-07-06 10:16:56 +02:00
Armin Ronacher
a101cfc35b
Worked around a werkzeug bug with redirects
2011-06-29 18:31:48 +02:00
Armin Ronacher
b36d7b3288
Added class based view documentation
2011-06-28 14:24:54 +02:00
Armin Ronacher
dcf21989dc
Added class based views
2011-06-28 12:45:49 +02:00
Armin Ronacher
ccd5ced70e
Chop of ports for session cookies. This fixes #253
2011-06-27 09:40:45 +02:00
Armin Ronacher
ea7a172077
Test that dotted names work. This fixes #258
2011-06-27 09:20:50 +02:00
Armin Ronacher
37fab78887
Added a migrated moduleapp as blueprint app
2011-06-17 03:39:49 +02:00
Armin Ronacher
e17e74d3a7
Started work on testcases for blueprints
2011-06-17 03:29:40 +02:00
Armin Ronacher
abe1378cae
Chnaged a bunch of behavior in blueprints for it to be more flexible. Improved backwards compat.
2011-06-16 23:55:49 +02:00
Armin Ronacher
f5ec9952de
Added blueprint specific error handling
2011-06-05 10:27:15 +02:00
Armin Ronacher
7a08331ac0
Latest iteration of the blueprint code. Far from being done
2011-05-29 15:54:58 +02:00
Armin Ronacher
673fa18e6d
Merge branch 'new-request-dispatching' into blueprints
2011-05-28 15:14:07 +02:00
Armin Ronacher
ba6bf23e0d
Updated tests
2011-05-27 20:12:20 +02:00
Armin Ronacher
e71a5ff8de
Started work on new request dispatching. Unittests not yet updated
2011-05-27 20:10:53 +02:00
Armin Ronacher
e3f2dd8f08
Added a test for content length behavior
2011-05-27 15:59:11 +02:00
Armin Ronacher
d90765b026
Added testcase for json encoding parameter support
2011-05-24 16:29:46 +02:00
Armin Ronacher
d8fcd4260e
Whitespace normalization
2011-04-18 23:19:59 +02:00
Armin Ronacher
a06cd0a644
Started work on implementing blueprint based template loading
2011-03-19 03:28:39 +01:00
Armin Ronacher
1446614915
Added deprecation warnings for modules
2011-03-18 09:30:56 +01:00
Armin Ronacher
0da56d7f5c
deprecated init_jinja_globals
2011-03-18 09:15:28 +01:00
Armin Ronacher
dd75cc9e28
Merge branch 'appdispatch-docs'
2011-03-15 12:07:32 -04:00
Armin Ronacher
97efffad9a
Enable deprecation warnings
2011-03-15 11:47:59 -04:00
Armin Ronacher
fbd488678f
Implemented flask.has_request_context()
2011-03-14 16:13:58 -04:00
Matt Chisholm
04e70bd5c7
Add teardown_request decorator. Fixes issue #174
2011-03-14 14:28:15 -04:00
Aaron Kavlie
fa9817778c
Test passes.
...
Added test for silent flag; added import of errno so it passed.
2011-03-14 10:41:22 -04:00