@@ -28,6 +28,10 @@ vi.mock('@/lib/internal/oci-resource-manager/operations', () => ({
2828
2929import { executeOciResourceManagerTool } from '@/lib/internal/oci-resource-manager/execute-tool'
3030import type { InternalToolOperationCall } from '@/lib/internal/tool-operations/types'
31+ import { OciResourceManagerBlock } from '@/blocks/blocks/oci_resource_manager'
32+ import { ociResourceManagerListConfigurationSourceProvidersTool } from '@/tools/oci_resource_manager/list_configuration_source_providers'
33+ import { ociResourceManagerListStacksTool } from '@/tools/oci_resource_manager/list_stacks'
34+ import { ociResourceManagerListTemplatesTool } from '@/tools/oci_resource_manager/list_templates'
3135
3236function request ( overrides : Partial < InternalToolOperationCall > = { } ) : InternalToolOperationCall {
3337 return {
@@ -59,6 +63,46 @@ beforeEach(() => {
5963 } )
6064} )
6165describe ( 'Resource Manager execution authorization' , ( ) => {
66+ it . each ( [
67+ [ 'list_stacks' , ociResourceManagerListStacksTool , { } ] ,
68+ [
69+ 'list_templates' ,
70+ ociResourceManagerListTemplatesTool ,
71+ { templateId : null , templateCategoryId : '0' } ,
72+ ] ,
73+ [
74+ 'list_configuration_source_providers' ,
75+ ociResourceManagerListConfigurationSourceProvidersTool ,
76+ { configurationSourceProviderId : null } ,
77+ ] ,
78+ ] as const ) (
79+ 'omits blank optional filters through the native %s block merge' ,
80+ async ( operation , tool , extra ) => {
81+ const raw = {
82+ operation,
83+ oauthCredential : 'supplied' ,
84+ compartmentId : 'compartment' ,
85+ displayName : null ,
86+ page : '' ,
87+ selectorCompartmentId : null ,
88+ ...extra ,
89+ }
90+ const params = { ...raw , ...OciResourceManagerBlock . tools . config ?. params ?.( raw ) }
91+ const response = await executeOciResourceManagerTool (
92+ request ( { toolId : tool . id , input : tool . operation . input ( params ) } )
93+ )
94+ expect ( response . status ) . toBe ( 200 )
95+ expect ( mocks . execute ) . toHaveBeenCalledWith (
96+ operation ,
97+ expect . objectContaining ( {
98+ compartmentId : 'compartment' ,
99+ displayName : undefined ,
100+ page : undefined ,
101+ } ) ,
102+ expect . anything ( )
103+ )
104+ }
105+ )
62106 it ( 'uses only the authorized credential ID and trusted workspace/actor' , async ( ) => {
63107 expect ( ( await executeOciResourceManagerTool ( request ( ) ) ) . status ) . toBe ( 200 )
64108 expect ( mocks . authorize ) . toHaveBeenCalledWith ( expect . objectContaining ( { userId : 'actor' } ) , {
0 commit comments