Merge branch '2.2.x'
This commit is contained in:
commit
fa0ceb62f2
4 changed files with 47 additions and 58 deletions
|
|
@ -260,8 +260,9 @@ def test_session_using_server_name(app, client):
|
|||
return "Hello World"
|
||||
|
||||
rv = client.get("/", "http://example.com/")
|
||||
assert "domain=.example.com" in rv.headers["set-cookie"].lower()
|
||||
assert "httponly" in rv.headers["set-cookie"].lower()
|
||||
cookie = rv.headers["set-cookie"].lower()
|
||||
# or condition for Werkzeug < 2.3
|
||||
assert "domain=example.com" in cookie or "domain=.example.com" in cookie
|
||||
|
||||
|
||||
def test_session_using_server_name_and_port(app, client):
|
||||
|
|
@ -273,8 +274,9 @@ def test_session_using_server_name_and_port(app, client):
|
|||
return "Hello World"
|
||||
|
||||
rv = client.get("/", "http://example.com:8080/")
|
||||
assert "domain=.example.com" in rv.headers["set-cookie"].lower()
|
||||
assert "httponly" in rv.headers["set-cookie"].lower()
|
||||
cookie = rv.headers["set-cookie"].lower()
|
||||
# or condition for Werkzeug < 2.3
|
||||
assert "domain=example.com" in cookie or "domain=.example.com" in cookie
|
||||
|
||||
|
||||
def test_session_using_server_name_port_and_path(app, client):
|
||||
|
|
@ -336,7 +338,8 @@ def test_session_using_session_settings(app, client):
|
|||
|
||||
rv = client.get("/", "http://www.example.com:8080/test/")
|
||||
cookie = rv.headers["set-cookie"].lower()
|
||||
assert "domain=.example.com" in cookie
|
||||
# or condition for Werkzeug < 2.3
|
||||
assert "domain=example.com" in cookie or "domain=.example.com" in cookie
|
||||
assert "path=/" in cookie
|
||||
assert "secure" in cookie
|
||||
assert "httponly" not in cookie
|
||||
|
|
@ -345,7 +348,8 @@ def test_session_using_session_settings(app, client):
|
|||
rv = client.get("/clear", "http://www.example.com:8080/test/")
|
||||
cookie = rv.headers["set-cookie"].lower()
|
||||
assert "session=;" in cookie
|
||||
assert "domain=.example.com" in cookie
|
||||
# or condition for Werkzeug < 2.3
|
||||
assert "domain=example.com" in cookie or "domain=.example.com" in cookie
|
||||
assert "path=/" in cookie
|
||||
assert "secure" in cookie
|
||||
assert "samesite" in cookie
|
||||
|
|
|
|||
|
|
@ -267,25 +267,6 @@ def _has_encoding(name):
|
|||
return False
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
not _has_encoding("euc-kr"), reason="The euc-kr encoding is required."
|
||||
)
|
||||
def test_modified_url_encoding(app, client):
|
||||
class ModifiedRequest(flask.Request):
|
||||
url_charset = "euc-kr"
|
||||
|
||||
app.request_class = ModifiedRequest
|
||||
app.url_map.charset = "euc-kr"
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return flask.request.args["foo"]
|
||||
|
||||
rv = client.get("/", query_string={"foo": "정상처리"}, charset="euc-kr")
|
||||
assert rv.status_code == 200
|
||||
assert rv.get_data(as_text=True) == "정상처리"
|
||||
|
||||
|
||||
def test_json_key_sorting(app, client):
|
||||
app.debug = True
|
||||
assert app.json.sort_keys
|
||||
|
|
|
|||
|
|
@ -206,10 +206,10 @@ def test_session_transactions_keep_context(app, client, req_ctx):
|
|||
|
||||
def test_session_transaction_needs_cookies(app):
|
||||
c = app.test_client(use_cookies=False)
|
||||
with pytest.raises(RuntimeError) as e:
|
||||
|
||||
with pytest.raises(TypeError, match="Cookies are disabled."):
|
||||
with c.session_transaction():
|
||||
pass
|
||||
assert "cookies" in str(e.value)
|
||||
|
||||
|
||||
def test_test_client_context_binding(app, client):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue