Skip to content

test(tools): use real ApiToolProvider and unbound_session in TestApiProviderToController - #45187

Open
jdabid wants to merge 2 commits into
langgenius:mainfrom
jdabid:test/tools-transform-service-session
Open

jdabid wants to merge 2 commits into
langgenius:mainfrom
jdabid:test/tools-transform-service-session

Conversation

@jdabid

@jdabid jdabid commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Part of #44973.

Replaces the MagicMock provider stand-in and patched db.session placeholder (session=ANY) in TestApiProviderToController (api/tests/unit_tests/services/tools/test_tools_transform_service.py) with a real ApiToolProvider model instance and the shared unbound_session fixture while preserving the boundary-wiring assertions on ApiToolProviderController.from_db.

Screenshots

N/A (test-only change)

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and vp staged (frontend) to appease the lint gods

@jdabid
jdabid requested a review from QuantumGhost as a code owner October 31, 2026 02:11
@github-actions github-actions Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 31, 2026
@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-10-31 02:30:03.619580727 +0000
+++ /tmp/pyrefly_pr.txt	2026-10-31 02:29:49.699397685 +0000
@@ -6313,15 +6313,15 @@
 ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.workflow_service.WorkflowService._build_human_input_node_for_debugging` [bad-argument-type]
     --> tests/unit_tests/services/test_workflow_service.py:3976:69
 ERROR Object of class `MCPToolProvider` has no attribute `provider_icon` [missing-attribute]
-  --> tests/unit_tests/services/tools/test_tools_transform_service.py:80:9
+  --> tests/unit_tests/services/tools/test_tools_transform_service.py:82:9
 ERROR Object of class `MCPToolProvider` has no attribute `masked_server_url` [missing-attribute]
-  --> tests/unit_tests/services/tools/test_tools_transform_service.py:81:9
+  --> tests/unit_tests/services/tools/test_tools_transform_service.py:83:9
 ERROR Object of class `MCPToolProvider` has no attribute `masked_headers` [missing-attribute]
-  --> tests/unit_tests/services/tools/test_tools_transform_service.py:82:9
+  --> tests/unit_tests/services/tools/test_tools_transform_service.py:84:9
 ERROR Object of class `MCPToolProvider` has no attribute `decrypted_headers` [missing-attribute]
-  --> tests/unit_tests/services/tools/test_tools_transform_service.py:83:9
+  --> tests/unit_tests/services/tools/test_tools_transform_service.py:85:9
 ERROR Object of class `Mapping` has no attribute `startswith` [missing-attribute]
-   --> tests/unit_tests/services/tools/test_tools_transform_service.py:797:20
+   --> tests/unit_tests/services/tools/test_tools_transform_service.py:819:20
 ERROR Argument `dict[str, Any]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]
    --> tests/unit_tests/services/trigger/test_schedule_service.py:533:61
 ERROR Argument `dict[str, str | dict[str, str]]` is not assignable to parameter `node_config` with type `NodeConfigDict` in function `services.trigger.schedule_service.ScheduleService.to_schedule_config` [bad-argument-type]

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 81.47% 81.47% +0.00%
Strict coverage 81.11% 81.12% +0.00%
Typed symbols 85,218 85,226 +8
Untyped symbols 19,472 19,468 -4
Modules 4387 4387 0

@codecov

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.84%. Comparing base (dca4024) to head (d3d7986).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #45187      +/-   ##
==========================================
- Coverage   89.84%   89.84%   -0.01%     
==========================================
  Files        6244     6244              
  Lines      397482   397482              
  Branches    80170    80170              
==========================================
- Hits       357116   357107       -9     
- Misses      34063    34071       +8     
- Partials     6303     6304       +1     
Flag Coverage Δ
api 89.70% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Oct 31, 2026
@asukaminato0721 asukaminato0721 self-assigned this Oct 31, 2026
@asukaminato0721
asukaminato0721 added this pull request to the merge queue Oct 31, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants