dify/api/tests/unit_tests/services/tools
GareArc d4834ddd98
fix(tools): scope builtin tool default-credential clear to tenant
When two workspace members each set their own credential as the default
for the same provider, both rows ended up with is_default=True for the
same (tenant_id, provider). The clear UPDATE was filtered by user_id,
so it only reset the caller's own defaults and left other members'
defaults intact. The consumer (`get_builtin_provider`) is tenant-scoped
and picks an arbitrary winner via the created_at tiebreak when multiple
defaults exist, producing user-visible inconsistencies.

Drop user_id from the clear filter so default selection becomes
properly tenant-scoped, matching
`DatasourceProviderService.set_default_datasource_provider`.

Adds a regression test that asserts the clear filter_by call uses
tenant_id/provider but not user_id.

Backport of equivalent fix on main to lts/1.13.x.
2026-05-07 02:30:35 -07:00
..
__init__.py refactor: Fix some type error (#22594) 2025-07-18 09:26:29 +08:00
test_builtin_tools_manage_service.py fix(tools): scope builtin tool default-credential clear to tenant 2026-05-07 02:30:35 -07:00
test_mcp_tools_transform.py fix: fix mcp tool parameter extract (#33258) 2026-03-11 13:46:38 +08:00
test_tool_labels_service.py test: add UTs for api/services recommend_app, tools, workflow (#32645) 2026-03-12 11:37:03 +08:00
test_tools_manage_service.py test: add UTs for api/services recommend_app, tools, workflow (#32645) 2026-03-12 11:37:03 +08:00