forked from orbit-oss/flask
Merge branch '2.1.x'
This commit is contained in:
commit
cb4f742543
5 changed files with 28 additions and 15 deletions
11
CHANGES.rst
11
CHANGES.rst
|
|
@ -6,6 +6,17 @@ Version 2.2.0
|
|||
Unreleased
|
||||
|
||||
|
||||
Version 2.1.2
|
||||
-------------
|
||||
|
||||
Unreleased
|
||||
|
||||
- Fix type annotation for ``json.loads``, it accepts str or bytes.
|
||||
:issue:`4519`
|
||||
- The ``--cert`` and ``--key`` options on ``flask run`` can be given
|
||||
in either order. :issue:`4459`
|
||||
|
||||
|
||||
Version 2.1.1
|
||||
-------------
|
||||
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ use ``pathlib.Path`` to get files relative to the current test file.
|
|||
|
||||
def test_edit_user(client):
|
||||
response = client.post("/user/2/edit", data={
|
||||
name="Flask",
|
||||
theme="dark",
|
||||
picture=(resources / "picture.png").open("rb"),
|
||||
"name": "Flask",
|
||||
"theme": "dark",
|
||||
"picture": (resources / "picture.png").open("rb"),
|
||||
})
|
||||
assert response.status_code == 200
|
||||
|
||||
|
|
|
|||
|
|
@ -763,7 +763,10 @@ class SeparatedPathType(click.Path):
|
|||
@click.option("--host", "-h", default="127.0.0.1", help="The interface to bind to.")
|
||||
@click.option("--port", "-p", default=5000, help="The port to bind to.")
|
||||
@click.option(
|
||||
"--cert", type=CertParamType(), help="Specify a certificate file to use HTTPS."
|
||||
"--cert",
|
||||
type=CertParamType(),
|
||||
help="Specify a certificate file to use HTTPS.",
|
||||
is_eager=True,
|
||||
)
|
||||
@click.option(
|
||||
"--key",
|
||||
|
|
|
|||
|
|
@ -153,7 +153,11 @@ def dump(
|
|||
_json.dump(obj, fp, **kwargs)
|
||||
|
||||
|
||||
def loads(s: str, app: t.Optional["Flask"] = None, **kwargs: t.Any) -> t.Any:
|
||||
def loads(
|
||||
s: t.Union[str, bytes],
|
||||
app: t.Optional["Flask"] = None,
|
||||
**kwargs: t.Any,
|
||||
) -> t.Any:
|
||||
"""Deserialize an object from a string of JSON.
|
||||
|
||||
Takes the same arguments as the built-in :func:`json.loads`, with
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import sys
|
|||
import types
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import click
|
||||
import pytest
|
||||
|
|
@ -25,7 +24,6 @@ from flask.cli import FlaskGroup
|
|||
from flask.cli import get_version
|
||||
from flask.cli import load_dotenv
|
||||
from flask.cli import locate_app
|
||||
from flask.cli import main as cli_main
|
||||
from flask.cli import NoAppException
|
||||
from flask.cli import prepare_import
|
||||
from flask.cli import run_command
|
||||
|
|
@ -555,9 +553,14 @@ def test_run_cert_path():
|
|||
with pytest.raises(click.BadParameter):
|
||||
run_command.make_context("run", ["--key", __file__])
|
||||
|
||||
# cert specified first
|
||||
ctx = run_command.make_context("run", ["--cert", __file__, "--key", __file__])
|
||||
assert ctx.params["cert"] == (__file__, __file__)
|
||||
|
||||
# key specified first
|
||||
ctx = run_command.make_context("run", ["--key", __file__, "--cert", __file__])
|
||||
assert ctx.params["cert"] == (__file__, __file__)
|
||||
|
||||
|
||||
def test_run_cert_adhoc(monkeypatch):
|
||||
monkeypatch.setitem(sys.modules, "cryptography", None)
|
||||
|
|
@ -654,11 +657,3 @@ def test_cli_empty(app):
|
|||
|
||||
result = app.test_cli_runner().invoke(args=["blue", "--help"])
|
||||
assert result.exit_code == 2, f"Unexpected success:\n\n{result.output}"
|
||||
|
||||
|
||||
def test_click_7_deprecated():
|
||||
with patch("flask.cli.cli"):
|
||||
if int(click.__version__[0]) < 8:
|
||||
pytest.deprecated_call(cli_main, match=".* Click 7 is deprecated")
|
||||
else:
|
||||
cli_main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue