mirror of
https://github.com/langgenius/dify.git
synced 2026-05-27 04:16:16 +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>
22 lines
629 B
Python
22 lines
629 B
Python
from controllers.openapi.auth.context import Context
|
|
|
|
|
|
def test_context_starts_unpopulated():
|
|
ctx = Context(required_scope="apps:run")
|
|
assert ctx.bearer_token is None
|
|
assert ctx.path_params == {}
|
|
assert ctx.subject_type is None
|
|
assert ctx.subject_email is None
|
|
assert ctx.account_id is None
|
|
assert ctx.scopes == frozenset()
|
|
assert ctx.app is None
|
|
assert ctx.tenant is None
|
|
assert ctx.caller is None
|
|
assert ctx.caller_kind is None
|
|
|
|
|
|
def test_context_fields_are_mutable():
|
|
ctx = Context(required_scope="apps:run")
|
|
ctx.scopes = frozenset({"full"})
|
|
assert "full" in ctx.scopes
|