4.46.2
All checks were successful
Build-Release-Image / Build-Image (linux/amd64) (push) Successful in 3m7s
Build-Release-Image / Build-Image (linux/arm64) (push) Successful in 4m35s
Build-Release-Image / Merge-Images (push) Successful in 21s
Build-Release-Image / Create-Release (push) Successful in 9s
Build-Release-Image / Notify (push) Successful in 3s

This commit is contained in:
2024-07-11 12:00:06 +01:00
parent f51d31f431
commit 9002bbad09
11 changed files with 48 additions and 10 deletions

View File

@ -1,5 +1,7 @@
import os
from flask import testing
# use the tests/test.env config fle
# flake8: noqa: E402
@ -42,7 +44,16 @@ def flask_app():
yield app
from app import config
from app import config, constants
class CustomTestClient(testing.FlaskClient):
def open(self, *args, **kwargs):
if isinstance(args[0], str):
headers = kwargs.pop("headers", {})
headers.update({constants.HEADER_ALLOW_API_COOKIES: "allow"})
kwargs["headers"] = headers
return super().open(*args, **kwargs)
@pytest.fixture
@ -53,7 +64,9 @@ def flask_client():
# disable rate limit during test
config.DISABLE_RATE_LIMIT = True
try:
app.test_client_class = CustomTestClient
client = app.test_client()
client.environ_base[constants.HEADER_ALLOW_API_COOKIES] = "allow"
yield client
finally:
# disable rate limit again as some tests might enable rate limit