"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/test_helpers.py" between
flask-1.1.1.tar.gz and flask-1.1.2.tar.gz

About: Flask is a lightweight Python WSGI web application framework.

test_helpers.py  (flask-1.1.1):test_helpers.py  (flask-1.1.2)
skipping to change at line 14 skipping to change at line 14
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
Various helpers. Various helpers.
:copyright: 2010 Pallets :copyright: 2010 Pallets
:license: BSD-3-Clause :license: BSD-3-Clause
""" """
import datetime import datetime
import io import io
import os import os
import sys
import uuid import uuid
import pytest import pytest
from werkzeug.datastructures import Range from werkzeug.datastructures import Range
from werkzeug.exceptions import BadRequest from werkzeug.exceptions import BadRequest
from werkzeug.exceptions import NotFound from werkzeug.exceptions import NotFound
from werkzeug.http import http_date from werkzeug.http import http_date
from werkzeug.http import parse_cache_control_header from werkzeug.http import parse_cache_control_header
from werkzeug.http import parse_options_header from werkzeug.http import parse_options_header
skipping to change at line 778 skipping to change at line 779
def test_send_from_directory_pathlike(self, app, req_ctx): def test_send_from_directory_pathlike(self, app, req_ctx):
app.root_path = os.path.join( app.root_path = os.path.join(
os.path.dirname(__file__), "test_apps", "subdomaintestmodule" os.path.dirname(__file__), "test_apps", "subdomaintestmodule"
) )
rv = flask.send_from_directory(FakePath("static"), FakePath("hello.txt") ) rv = flask.send_from_directory(FakePath("static"), FakePath("hello.txt") )
rv.direct_passthrough = False rv.direct_passthrough = False
assert rv.data.strip() == b"Hello Subdomain" assert rv.data.strip() == b"Hello Subdomain"
rv.close() rv.close()
def test_send_from_directory_bad_request(self, app, req_ctx): def test_send_from_directory_null_character(self, app, req_ctx):
app.root_path = os.path.join( app.root_path = os.path.join(
os.path.dirname(__file__), "test_apps", "subdomaintestmodule" os.path.dirname(__file__), "test_apps", "subdomaintestmodule"
) )
with pytest.raises(BadRequest): if sys.version_info >= (3, 8):
exception = NotFound
else:
exception = BadRequest
with pytest.raises(exception):
flask.send_from_directory("static", "bad\x00") flask.send_from_directory("static", "bad\x00")
class TestUrlFor(object): class TestUrlFor(object):
def test_url_for_with_anchor(self, app, req_ctx): def test_url_for_with_anchor(self, app, req_ctx):
@app.route("/") @app.route("/")
def index(): def index():
return "42" return "42"
assert flask.url_for("index", _anchor="x y") == "/#x%20y" assert flask.url_for("index", _anchor="x y") == "/#x%20y"
 End of changes. 3 change blocks. 
2 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)