mirror of
https://github.com/langgenius/dify.git
synced 2026-05-27 20:36:18 +08:00
Co-authored-by: GareArc <garethcxy@dify.ai> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: L1nSn0w <l1nsn0w@qq.com> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: gigglewang <gigglewang@dify.ai> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
33 lines
816 B
Python
33 lines
816 B
Python
import pytest
|
|
from flask import Flask
|
|
|
|
from controllers.openapi import bp as openapi_bp
|
|
from controllers.openapi.auth.pipeline import Pipeline
|
|
|
|
|
|
@pytest.fixture
|
|
def bypass_pipeline(monkeypatch):
|
|
"""Stub Pipeline.run so endpoint decoration does not invoke real auth.
|
|
|
|
Module-level @OAUTH_BEARER_PIPELINE.guard(...) captures the real
|
|
pipeline at import time; mocking the module attribute does not undo
|
|
that. Patching Pipeline.run on the class is the bypass that actually
|
|
works.
|
|
"""
|
|
monkeypatch.setattr(Pipeline, "run", lambda self, ctx: None)
|
|
|
|
|
|
@pytest.fixture
|
|
def openapi_app():
|
|
app = Flask(__name__)
|
|
app.config["TESTING"] = True
|
|
app.register_blueprint(openapi_bp)
|
|
return app
|
|
|
|
|
|
@pytest.fixture
|
|
def app():
|
|
a = Flask(__name__)
|
|
a.config["TESTING"] = True
|
|
return a
|