Commit Graph

646 Commits

Author SHA1 Message Date
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
Armin Ronacher 00c5b7a937 added create_jinja_loader 2011-02-21 21:56:37 +01:00
mvantellingen 8a73097fe5 Add unittests for the endpoint decorator
Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
2011-01-24 13:49:11 +01:00
Armin Ronacher 99be2ec022 Flask no longer internally depends on rules being added through the add_url_rule function 2011-01-16 17:13:25 +01:00
Armin Ronacher 11c66be80e Added testcase for an issue that may exist on windows 2010-12-23 14:23:33 +01:00
Armin Ronacher 164067920b Updated examples to work with pypy which has a incomplete sqlite3 in 1.4. Also disable a euc-kr test that does not work on pypy 2010-12-01 17:22:55 +01:00
Armin Ronacher 8569dfee61 Added a PROPAGATE_EXCEPTIONS flag 2010-11-29 08:57:38 +01:00
Pedro Algarvio a327452540 Better handling for `test_request_context` don't just append the port.
Also implemented a proper initial environment to use with
`Flask.test_app()` based on the application's configuration.

Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
2010-10-22 18:19:21 +03:00
Pedro Algarvio 88883aa6db Fix for Flask's ticket 126. A proper environment is now built to use
with `test_request_context()`.

Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
2010-10-22 15:36:47 +03:00
Armin Ronacher 1d2a308c20 merged 2010-10-19 09:09:55 +02:00
Armin Ronacher 2a73bbc436 Added testcase. This fixes #108 2010-08-20 11:16:18 +02:00
Armin Ronacher 9a21c34bb6 Added another testcase 2010-08-10 22:55:40 +02:00
Armin Ronacher a3a843999b normpath is now used before loading templates 2010-08-09 15:16:02 +02:00
Armin Ronacher fda14678c0 Deprecated send_file etag support and mimetype guessing for file-like objects. This fixes #104 2010-08-07 13:36:39 +02:00
Armin Ronacher faa1c71e45 Request local objects now fail properly with a RuntimeError. This fixes #105 2010-08-07 13:02:53 +02:00
Armin Ronacher c9002569c9 Various pyflakes fixes 2010-08-03 12:15:15 +02:00
Armin Ronacher 778e44e39e Improved error message for configuration files 2010-07-30 00:03:06 +02:00
Armin Ronacher 8e7d29176a Merge branch 'master' of github.com:mitsuhiko/flask 2010-07-28 01:28:31 +02:00
Armin Ronacher dbf55de7e8 Fixed an issue where the default `OPTIONS` response was
not exposing all valid methods in the `Allow` header.

This fixes #97

Signed-off-by: Armin Ronacher <armin.ronacher@active-4.com>
2010-07-28 01:28:00 +02:00
Ronny Pfannschmidt 4cd5201cdd use custom tox file named tox-flask-test.ini, dont delete the real tox.ini 2010-07-28 05:34:04 +08:00
Armin Ronacher 6aeb6a09af Added standard dep on py because some extensions might use py.test and the default available version is on the wrong python path 2010-07-26 02:52:05 +02:00
Armin Ronacher 8bd8b014a8 Small fixes in the extension tester 2010-07-26 02:30:52 +02:00
Armin Ronacher 140fc45ebd Added another workaround. the extension tester is now a pile of hacks 2010-07-26 00:59:41 +02:00
Armin Ronacher 63a37b75ac Improved extension test runner 2010-07-26 00:36:09 +02:00
Armin Ronacher d455135338 Added a workaround for py.test 2010-07-25 23:46:24 +02:00
Armin Ronacher 3a80ecc660 Improved script for automatic extension testing 2010-07-25 17:33:45 +02:00
Armin Ronacher f4bfae622b Added flaskext tester 2010-07-23 15:41:39 +01:00
Armin Ronacher 7680d52f42 Added support for subdomain bound modules 2010-07-23 13:29:21 +01:00
Armin Ronacher b49afa21ad Removed temp subscription contextmanager in blinker tests to support upcoming api improvements better 2010-07-20 15:09:51 +01:00
Armin Ronacher c5b1755317 Added testcase for modified URL encodings 2010-07-20 13:48:13 +01:00
Armin Ronacher e0712b47c6 Added support for signals 2010-07-17 14:39:28 +02:00
Armin Ronacher a59dfe4a77 Added missing template 2010-07-17 14:02:02 +02:00
Armin Ronacher 6fc1492357 Added make_response 2010-07-17 11:36:16 +02:00
Armin Ronacher f5b8c08284 endpoint is optional for modules. This fixes #86 2010-07-15 14:35:02 +02:00
Armin Ronacher 85ff63c32e Emit correct date. In theory 2010-07-13 23:52:55 +02:00
Armin Ronacher aa3d8398fd Config is now available in templates, context processors no longer override keys 2010-07-13 23:30:29 +02:00
Armin Ronacher 5e1b1030e8 Added support for automagic OPTIONS 2010-07-12 23:04:24 +02:00
Armin Ronacher d12d73263f Reverse order of execution of post-request handlers. This fixes #82 2010-07-12 18:04:10 +02:00
Armin Ronacher 0a93c552cc Fixed a template lookup error 2010-07-06 19:24:50 +02:00
Armin Ronacher da514b3984 Respect the domain for the session cookie. This fixes #79 2010-07-06 10:42:36 +02:00
Armin Ronacher ac13deff40 Re-added support for folder with static files, refactored static file sending 2010-07-05 10:23:35 +02:00
Armin Ronacher 8945a97a42 fixed possible security problem in module branch 2010-07-04 20:36:34 +02:00
Armin Ronacher d67a36cbdb Added a testcase for the improved module support 2010-07-04 14:12:29 +02:00
Armin Ronacher 8798b4b711 Merged in changes from master by hand 2010-07-04 11:25:26 +02:00
Armin Ronacher 81148db5b6 Merged in changes from justquick 2010-07-04 11:20:45 +02:00
Armin Ronacher 7599046d04 Started working on refactoring Jinja integration 2010-07-04 11:16:24 +02:00
Justin Quick 1a69c7d4bf look for json module in the right place. all tests
now pass with the new module layout
2010-07-02 15:11:02 -04:00
Armin Ronacher bcd746e8cf Added another testcase for subdomain support 2010-06-29 01:36:06 +02:00
Armin Ronacher f195d92447 Added proper subdomain support 2010-06-29 01:13:40 +02:00
Armin Ronacher d44b127748 Use a custom logger subclass that uses DEBUG level if in debug mode 2010-06-18 16:53:38 +02:00
Armin Ronacher 9983e84742 Fixed after_request handlers being called twice in some cases and improved logging system 2010-06-03 16:21:23 +02:00
Armin Ronacher bc00fd1e83 Added support for deferred context cleanup. test_client users can now access the context locals after the actual request if the client is used with a with-block. This fixes #59. 2010-06-03 15:26:07 +02:00
Armin Ronacher 33e7f2b990 Invoke after_request on exceptions as well. This fixes #59 2010-06-02 18:04:49 +02:00
Simon Sapin 7a4b608839 Add Module.app_errorhandler, like Flask.errorhandler. 2010-05-31 23:28:58 +08:00
Armin Ronacher 6cb0855e2d Fixed an error reporting bug with flask.Config.from_envvar 2010-05-28 21:37:27 +02:00
Armin Ronacher 672eaf7abf Merge branch 'config-support' of github.com:mitsuhiko/flask into config-support
Conflicts:
	flask.py
	tests/flask_tests.py
2010-05-27 13:34:56 +02:00
Armin Ronacher 35fd6eb22c Use uppercase for config and support any object. 2010-05-27 13:31:36 +02:00
Armin Ronacher 4d16486132 Improved configuration support. 2010-05-27 13:31:35 +02:00
Armin Ronacher ef0dc1800f Added interactive Python docs, fixed part style. 2010-05-24 18:37:48 +02:00
Armin Ronacher c4cac0abc1 Improved configuration support. 2010-05-18 02:36:50 +02:00
Armin Ronacher b26aeba972 Fixed a testcase 2010-05-18 01:41:42 +02:00
Armin Ronacher ea5e654e9e Added a documentation chapter about logging 2010-05-17 22:46:35 +02:00
Armin Ronacher e7f67e1333 Added logging support. 2010-05-17 16:06:30 +02:00
Armin Ronacher 35ed617fe4 Added support for flashing categories.
This fixes #35.
2010-05-17 00:37:55 +02:00
Armin Ronacher 9fa4f94ad8 Merge branch 'master' into module-support
Conflicts:
	CHANGES
	docs/_themes
	tests/flask_tests.py
2010-05-12 01:04:35 +02:00
Armin Ronacher 2d87e9bc37 Added support for send_file 2010-05-10 11:27:42 +02:00
Armin Ronacher 745638e774 Added missing decorators for module wide context processors.
This fixes #25.
2010-05-04 11:51:07 +02:00
Armin Ronacher a921aef6c4 Fixed late binding of url_prefix. This fixes #29. 2010-05-04 11:41:54 +02:00
Armin Ronacher 720bede150 Merge branch 'master' into module-support 2010-05-03 20:04:38 +02:00
florentx 67fc465262 Fix typo, remove useless import, limit lines to 79 columns. 2010-05-04 02:03:20 +08:00
Armin Ronacher 9da5795d79 Merge branch 'master' into module-support 2010-05-03 20:00:42 +02:00
Armin Ronacher dffb3d091c Removed useless import and adapted tests 2010-05-03 14:39:16 +02:00
Armin Ronacher 36f659b82b Merge branch 'master' into module-support
Conflicts:
	flask.py
2010-05-02 19:12:00 +02:00
Armin Ronacher 75461c1467 Added _external support to url_for 2010-05-02 19:10:44 +02:00
Armin Ronacher eeb0e94951 Fixed merging confict 2010-05-02 12:09:31 +02:00
Armin Ronacher 36717b0273 Added support for long running sessions. This closes #16. 2010-04-27 14:32:09 +02:00
Armin Ronacher 36e24299e3 Merge branch 'master' into module-support 2010-04-25 14:54:33 +02:00
Sebastien Estienne 4395e9493c add tests for template_filter using a real template 2010-04-25 20:51:27 +08:00
Sebastien Estienne 5c9ef2c44d the template_filter now expects the parentheses 2010-04-25 20:51:27 +08:00
Sebastien Estienne a9bb965b6d add a decorator to add custom template filter 2010-04-25 20:51:26 +08:00
Armin Ronacher 5144d3b65a Merge branch 'master' into module-support 2010-04-24 17:47:24 +02:00
Armin Ronacher 67f4b0f315 Modules are now instanciated with the package name.
This makes it possible to load resources from the folder the module is
located in.
2010-04-24 17:07:16 +02:00
Armin Ronacher 5c52fe980e Added request/response processing based on modules. 2010-04-23 17:10:22 +02:00
Armin Ronacher e0148a00c0 Basic module support is working, but does not look very nice. 2010-04-23 17:01:20 +02:00
Armin Ronacher a862ead5f2 Warn on None responses. 2010-04-23 16:30:04 +02:00
florentx dbe0df756b Use setdefault() because it sets session.modified correctly. 2010-04-21 16:36:20 +08:00
Armin Ronacher 9f6bc93e4d Fixed XSS problem by escaping all slashes in JSON.
This also probes simplejson first to figure out if it escapes slashes
which it did in earlier versions.
2010-04-20 15:12:16 +02:00
Armin Ronacher 9f0b2429d6 The testsuite skips JSON tests now is not available and runs the example
tests as well.
2010-04-20 10:51:36 +02:00
Armin Ronacher 95750b3287 Documented some routing converter possibilities. 2010-04-19 23:49:02 +02:00
unknown 3088a9371e Make it easier to associate a rule, endpoint and view_function
This resolves http://github.com/mitsuhiko/flask/issues/issue/11
2010-04-20 01:33:12 +08:00
Armin Ronacher ade490514d Fixed a security problem caused by changed simplejson semantics.
Notice: this was never in a release version of Flask.
2010-04-19 18:51:04 +02:00
Armin Ronacher 6e2be6a0b3 Added JSON Support and started working on jQuery docs 2010-04-19 15:39:07 +02:00
Armin Ronacher 190059c8f0 Added support for macro pulling and documented certain design decisions. 2010-04-18 15:44:06 +02:00
Armin Ronacher 5310fc3822 Session falls back to a dummy object now if secret_key is missing.
This makes it possible to still read-only access the empty session but
requires the secret key to be set for write access.  The error message
raised explains that.  This closes #10.
2010-04-17 14:10:47 +02:00
Armin Ronacher fb2d2e446b request_init -> before_request and request_shutdown -> after_request
This fixes #9.
2010-04-16 11:03:16 +02:00
Armin Ronacher ca520fb7e4 Static files are active in the WSGI app now, not just the server. 2010-04-14 14:11:00 +02:00
Armin Ronacher 08f1f0dc32 Added more Flask tests 2010-04-14 02:42:12 +02:00