mirror of
https://github.com/langgenius/dify.git
synced 2026-04-15 18:06:36 +08:00
Merge branch 'feat/collaboration2' of github.com:langgenius/dify into feat/collaboration2
This commit is contained in:
commit
d32bc1a364
@ -6,7 +6,8 @@ from typing import Any
|
|||||||
from flask import abort, request
|
from flask import abort, request
|
||||||
from flask_restx import Resource, fields, marshal_with
|
from flask_restx import Resource, fields, marshal_with
|
||||||
from graphon.enums import NodeType
|
from graphon.enums import NodeType
|
||||||
from graphon.file import File, helpers as file_helpers
|
from graphon.file import File
|
||||||
|
from graphon.file import helpers as file_helpers
|
||||||
from graphon.graph_engine.manager import GraphEngineManager
|
from graphon.graph_engine.manager import GraphEngineManager
|
||||||
from graphon.model_runtime.utils.encoders import jsonable_encoder
|
from graphon.model_runtime.utils.encoders import jsonable_encoder
|
||||||
from pydantic import BaseModel, Field, ValidationError, field_validator
|
from pydantic import BaseModel, Field, ValidationError, field_validator
|
||||||
|
|||||||
@ -293,9 +293,7 @@ def test_advanced_chat_run_conversation_not_exists(app, monkeypatch: pytest.Monk
|
|||||||
handler(api, app_model=SimpleNamespace(id="app"))
|
handler(api, app_model=SimpleNamespace(id="app"))
|
||||||
|
|
||||||
|
|
||||||
def test_workflow_online_users_filters_inaccessible_workflow(
|
def test_workflow_online_users_filters_inaccessible_workflow(app, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
app, monkeypatch: pytest.MonkeyPatch
|
|
||||||
) -> None:
|
|
||||||
app_id_1 = "11111111-1111-1111-1111-111111111111"
|
app_id_1 = "11111111-1111-1111-1111-111111111111"
|
||||||
app_id_2 = "22222222-2222-2222-2222-222222222222"
|
app_id_2 = "22222222-2222-2222-2222-222222222222"
|
||||||
signed_avatar_url = "https://files.example.com/signed/avatar-1"
|
signed_avatar_url = "https://files.example.com/signed/avatar-1"
|
||||||
@ -353,9 +351,7 @@ def test_workflow_online_users_filters_inaccessible_workflow(
|
|||||||
sign_avatar.assert_called_once_with("avatar-file-id")
|
sign_avatar.assert_called_once_with("avatar-file-id")
|
||||||
|
|
||||||
|
|
||||||
def test_workflow_online_users_rejects_excessive_workflow_ids(
|
def test_workflow_online_users_rejects_excessive_workflow_ids(app, monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
app, monkeypatch: pytest.MonkeyPatch
|
|
||||||
) -> None:
|
|
||||||
monkeypatch.setattr(workflow_module, "current_account_with_tenant", lambda: (SimpleNamespace(), "tenant-1"))
|
monkeypatch.setattr(workflow_module, "current_account_with_tenant", lambda: (SimpleNamespace(), "tenant-1"))
|
||||||
accessible_app_ids = Mock(return_value=set())
|
accessible_app_ids = Mock(return_value=set())
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
@ -364,9 +360,7 @@ def test_workflow_online_users_rejects_excessive_workflow_ids(
|
|||||||
lambda: SimpleNamespace(get_accessible_app_ids=accessible_app_ids),
|
lambda: SimpleNamespace(get_accessible_app_ids=accessible_app_ids),
|
||||||
)
|
)
|
||||||
|
|
||||||
excessive_ids = ",".join(
|
excessive_ids = ",".join(f"wf-{index}" for index in range(workflow_module.MAX_WORKFLOW_ONLINE_USERS_QUERY_IDS + 1))
|
||||||
f"wf-{index}" for index in range(workflow_module.MAX_WORKFLOW_ONLINE_USERS_QUERY_IDS + 1)
|
|
||||||
)
|
|
||||||
|
|
||||||
api = workflow_module.WorkflowOnlineUsersApi()
|
api = workflow_module.WorkflowOnlineUsersApi()
|
||||||
handler = _unwrap(api.get)
|
handler = _unwrap(api.get)
|
||||||
|
|||||||
@ -129,9 +129,7 @@ class WriteCase:
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_write_endpoints_require_edit_permission(
|
def test_write_endpoints_require_edit_permission(app: Flask, monkeypatch: pytest.MonkeyPatch, case: WriteCase) -> None:
|
||||||
app: Flask, monkeypatch: pytest.MonkeyPatch, case: WriteCase
|
|
||||||
) -> None:
|
|
||||||
app.config.setdefault("RESTX_MASK_HEADER", "X-Fields")
|
app.config.setdefault("RESTX_MASK_HEADER", "X-Fields")
|
||||||
account = _make_account(TenantAccountRole.NORMAL)
|
account = _make_account(TenantAccountRole.NORMAL)
|
||||||
app_model = _make_app()
|
app_model = _make_app()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user