fix(tests): correct keyword arguments in tool provider test constructors#33767
Conversation
Fix unexpected keyword argument errors in _create_test_tool_provider helper by aligning constructor arguments with actual SQLAlchemy model definitions: - ApiToolProvider: remove icon_dark and provider_type, rename credentials to credentials_str, add required schema/schema_type_str/tools_str - BuiltinToolProvider: remove description/icon/icon_dark, rename credentials to encrypted_credentials, add required user_id - WorkflowToolProvider: remove icon_dark, rename workflow_id to app_id, add required label/version/parameter_configuration - MCPToolProvider: remove description, rename provider_icon to icon, add required server_url_hash Closes langgenius#32592
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses keyword argument errors in the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes issues with unexpected keyword arguments in test tool provider constructors by aligning them with the model definitions. The changes are logical and address the problem described. I've added a few suggestions to improve the maintainability of the test code by using json.dumps for generating JSON strings instead of hardcoding them, which is less error-prone and more readable.
api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py
Show resolved
Hide resolved
api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py
Show resolved
Hide resolved
api/tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py
Show resolved
Hide resolved
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-03-19 14:11:32.254993005 +0000
+++ /tmp/pyrefly_pr.txt 2026-03-19 14:11:23.086861029 +0000
@@ -1417,28 +1417,6 @@
--> tests/test_containers_integration_tests/services/tools/test_mcp_tools_manage_service.py:63:20
ERROR Argument `Literal['normal']` is not assignable to parameter `status` with type `SQLCoreOperations[TenantStatus] | TenantStatus` in function `models.account.Tenant.__init__` [bad-argument-type]
--> tests/test_containers_integration_tests/services/tools/test_mcp_tools_manage_service.py:72:20
-ERROR Unexpected keyword argument `icon_dark` in function `models.tools.ApiToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:51:17
-ERROR Unexpected keyword argument `credentials` in function `models.tools.ApiToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:54:17
-ERROR Unexpected keyword argument `provider_type` in function `models.tools.ApiToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:55:17
-ERROR Unexpected keyword argument `description` in function `models.tools.BuiltinToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:60:17
-ERROR Unexpected keyword argument `icon` in function `models.tools.BuiltinToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:61:17
-ERROR Unexpected keyword argument `icon_dark` in function `models.tools.BuiltinToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:62:17
-ERROR Unexpected keyword argument `credentials` in function `models.tools.BuiltinToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:66:17
-ERROR Unexpected keyword argument `icon_dark` in function `models.tools.WorkflowToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:73:17
-ERROR Unexpected keyword argument `workflow_id` in function `models.tools.WorkflowToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:76:17
-ERROR Unexpected keyword argument `description` in function `models.tools.MCPToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:81:17
-ERROR Unexpected keyword argument `provider_icon` in function `models.tools.MCPToolProvider.__init__` [unexpected-keyword]
- --> tests/test_containers_integration_tests/services/tools/test_tools_transform_service.py:82:17
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
--> tests/test_containers_integration_tests/services/tools/test_workflow_tools_manage_service.py:109:38
ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
|
Important
Fixes #<issue number>.Summary
Fixes #32592
Fix unexpected keyword argument errors in the
_create_test_tool_providerhelper method intest_tools_transform_service.pyby aligning constructor arguments with the actual SQLAlchemy model definitions inapi/models/tools.py.Changes per provider:
icon_darkandprovider_type; renamecredentialstocredentials_str; add requiredschema,schema_type_str,tools_strdescription,icon,icon_dark; renamecredentialstoencrypted_credentials; add requireduser_idicon_dark; renameworkflow_idtoapp_id; add requiredlabel,version,parameter_configurationdescription; renameprovider_icontoicon; add requiredserver_url_hashThe corrected field names are consistent with usage elsewhere in the test file (e.g.,
test_api_provider_to_controller_successat line 652) and inapi/tests/unit_tests/models/test_tool_models.py.Checklist
make lintandmake type-check(backend) andcd web && npx lint-staged(frontend) to appease the lint gods