1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
Files
quay/endpoints/test/test_anon_checked.py
Kenny Lee Sin Cheong 72f7c64ed6 chore: update werkzeug and related package versions (PROJQUAY-5098) (#1982)
* chore: update werkzeug and related package versions (PROJQUAY-5098)

Path converter related change reference: https://github.com/pallets/werkzeug/issues/2506

* Update query count
2023-09-12 11:51:09 -04:00

41 lines
1.0 KiB
Python

import pytest
from app import app
from endpoints.v1 import v1_bp
from endpoints.v2 import v2_bp
@pytest.mark.parametrize(
"blueprint",
[
v2_bp,
v1_bp,
],
)
def test_verify_blueprint(blueprint):
class Checker(object):
def __init__(self):
self.first_registration = True
self.app = app
def add_url_rule(
self,
rule,
endpoint=None,
view_function=None,
methods=None,
provide_automatic_options=None,
**options,
):
result = "__anon_protected" in dir(view_function) or "__anon_allowed" in dir(
view_function
)
error_message = (
"Missing anonymous access protection decorator on function "
+ "%s under blueprint %s" % (endpoint, blueprint.name)
)
assert result, error_message
for deferred_function in blueprint.deferred_functions:
deferred_function(Checker())