Compare commits

..

No commits in common. "6d21c82e635386b0f960b0154463142cd3b651b6" and "f20c4626858d1c7fc3b7f600fcae234c272260b2" have entirely different histories.

6 changed files with 12 additions and 26 deletions

View File

@ -2,14 +2,6 @@ Change Log
========== ==========
Version 1.6.1
--------------
Released 2024/12/3
Fixed to work with httpx 0.28.0.
Version 1.6.0 Version 1.6.0
-------------- --------------

View File

@ -43,7 +43,7 @@ dependencies = [
[project.optional-dependencies] [project.optional-dependencies]
devel = [ devel = [
"httpx >= 0.20.0", "httpx",
"OpenCC", "OpenCC",
] ]

View File

@ -24,7 +24,7 @@ from flask_sqlalchemy import SQLAlchemy
from accounting.utils.user import UserUtilityInterface from accounting.utils.user import UserUtilityInterface
VERSION: str = "1.6.1" VERSION: str = "1.6.0"
"""The package version.""" """The package version."""
db: SQLAlchemy = SQLAlchemy() db: SQLAlchemy = SQLAlchemy()
"""The database instance.""" """The database instance."""

View File

@ -49,7 +49,7 @@ def create_app(is_testing: bool = False) -> Flask:
import accounting import accounting
app: Flask = Flask(__name__) app: Flask = Flask(__name__)
db_uri: str = "sqlite://" if is_testing else "sqlite:///local.sqlite" db_uri: str = "sqlite:///" if is_testing else "sqlite:///local.sqlite"
app.config.from_mapping({ app.config.from_mapping({
"SECRET_KEY": os.environ.get("SECRET_KEY", token_urlsafe(32)), "SECRET_KEY": os.environ.get("SECRET_KEY", token_urlsafe(32)),
"SESSION_COOKIE_SAMESITE": "Lax", "SESSION_COOKIE_SAMESITE": "Lax",

View File

@ -67,8 +67,7 @@ class NextUriTestCase(unittest.TestCase):
self.__app.add_url_rule("/test-next", view_func=test_next_uri_view, self.__app.add_url_rule("/test-next", view_func=test_next_uri_view,
methods=["GET", "POST"]) methods=["GET", "POST"])
client: httpx.Client = httpx.Client( client: httpx.Client = httpx.Client(app=self.__app,
transport=httpx.WSGITransport(app=self.__app),
base_url=TEST_SERVER) base_url=TEST_SERVER)
client.headers["Referer"] = TEST_SERVER client.headers["Referer"] = TEST_SERVER
csrf_token: str = get_csrf_token(client) csrf_token: str = get_csrf_token(client)
@ -97,8 +96,7 @@ class NextUriTestCase(unittest.TestCase):
self.__app.add_url_rule("/test-no-next", self.__app.add_url_rule("/test-no-next",
view_func=test_no_next_uri_view, view_func=test_no_next_uri_view,
methods=["GET", "POST"]) methods=["GET", "POST"])
client: httpx.Client = httpx.Client( client: httpx.Client = httpx.Client(app=self.__app,
transport=httpx.WSGITransport(app=self.__app),
base_url=TEST_SERVER) base_url=TEST_SERVER)
client.headers["Referer"] = TEST_SERVER client.headers["Referer"] = TEST_SERVER
csrf_token: str = get_csrf_token(client) csrf_token: str = get_csrf_token(client)
@ -124,8 +122,7 @@ class NextUriTestCase(unittest.TestCase):
self.__app.add_url_rule("/test-invalid-next", self.__app.add_url_rule("/test-invalid-next",
view_func=test_invalid_next_uri_view, view_func=test_invalid_next_uri_view,
methods=["GET", "POST"]) methods=["GET", "POST"])
client: httpx.Client = httpx.Client( client: httpx.Client = httpx.Client(app=self.__app,
transport=httpx.WSGITransport(app=self.__app),
base_url=TEST_SERVER) base_url=TEST_SERVER)
client.headers["Referer"] = TEST_SERVER client.headers["Referer"] = TEST_SERVER
csrf_token: str = get_csrf_token(client) csrf_token: str = get_csrf_token(client)
@ -230,8 +227,7 @@ class PaginationTestCase(unittest.TestCase):
self.assertEqual(pagination.list, self.__params.result) self.assertEqual(pagination.list, self.__params.result)
return "" return ""
self.__client: httpx.Client = httpx.Client( self.__client: httpx.Client = httpx.Client(app=self.__app,
transport=httpx.WSGITransport(app=self.__app),
base_url=TEST_SERVER) base_url=TEST_SERVER)
"""The user client.""" """The user client."""
self.__client.headers["Referer"] = TEST_SERVER self.__client.headers["Referer"] = TEST_SERVER

View File

@ -96,9 +96,7 @@ def get_client(app: Flask, username: str) -> httpx.Client:
:param username: The username. :param username: The username.
:return: The user client. :return: The user client.
""" """
client: httpx.Client = httpx.Client( client: httpx.Client = httpx.Client(app=app, base_url=TEST_SERVER)
transport=httpx.WSGITransport(app=app),
base_url=TEST_SERVER)
client.headers["Referer"] = TEST_SERVER client.headers["Referer"] = TEST_SERVER
csrf_token: str = get_csrf_token(client) csrf_token: str = get_csrf_token(client)
with app.app_context(): with app.app_context():