@@ -53,7 +53,7 @@ class MockDatum:
5353 type = 'custom'
5454 value = 'original'
5555 python_value = 'python version'
56-
56+
5757 data = MockDatum ()
5858 result = ConnectorTriggerConverter .decode (data , trigger_metadata = {})
5959 self .assertEqual (result , 'python version' )
@@ -109,7 +109,7 @@ def test_encode_other_type(self):
109109 def test_connector_context_is_dict_subclass (self ):
110110 # Verify ConnectorContext is a dict subclass
111111 self .assertTrue (issubclass (ConnectorContext , dict ))
112-
112+
113113 # Test that it can be instantiated and used as a dict
114114 ctx = ConnectorContext ({'key' : 'value' })
115115 self .assertEqual (ctx ['key' ], 'value' )
@@ -121,48 +121,55 @@ class TestConnectorDecoratorIntegration(unittest.TestCase):
121121 def test_decorator_creates_function_with_trigger (self ):
122122 app = func .FunctionApp ()
123123
124- @app .generic_connector_trigger (arg_name = "payload" )
124+ @app .connector_trigger (arg_name = "payload" )
125125 def connector_function (payload ):
126126 return f"Received: { payload } "
127127
128- # Verify the function was decorated
129- self .assertIsNotNone (connector_function )
130-
131- # Check that it has the expected structure
132- # The decorator should return a Function object
133- self .assertTrue (hasattr (connector_function , 'get_triggers' ))
128+ # Get the built function
129+ funcs = app .get_functions ()
130+ self .assertEqual (len (funcs ), 1 )
131+
132+ built_func = funcs [0 ]
133+ self .assertIsNotNone (built_func .get_trigger ())
134+ self .assertEqual (built_func .get_trigger ().type , 'connectorTrigger' )
134135
135136 def test_decorator_with_data_type (self ):
136137 app = func .FunctionApp ()
137138
138- @app .generic_connector_trigger (
139+ @app .connector_trigger (
139140 arg_name = "context" ,
140141 data_type = func .DataType .STRING
141142 )
142143 def connector_with_datatype (context ):
143144 return context
144145
145- self .assertIsNotNone (connector_with_datatype )
146- self .assertTrue (hasattr (connector_with_datatype , 'get_triggers' ))
146+ funcs = app .get_functions ()
147+ self .assertEqual (len (funcs ), 1 )
148+
149+ built_func = funcs [0 ]
150+ trigger = built_func .get_trigger ()
151+ self .assertIsNotNone (trigger )
152+ self .assertEqual (trigger .get_dict_repr ()['dataType' ], func .DataType .STRING )
147153
148154 def test_decorator_with_kwargs (self ):
149155 app = func .FunctionApp ()
150156
151- @app .generic_connector_trigger (
157+ @app .connector_trigger (
152158 arg_name = "data" ,
153159 custom_field = "custom_value" ,
154160 another_property = 123
155161 )
156162 def connector_with_kwargs (data ):
157163 return data
158164
159- self .assertIsNotNone (connector_with_kwargs )
160-
161- # Verify trigger was added with kwargs
162- triggers = connector_with_kwargs .get_triggers ()
163- self .assertEqual (len (triggers ), 1 )
164-
165- trigger_dict = triggers [0 ].get_dict_repr ()
165+ funcs = app .get_functions ()
166+ self .assertEqual (len (funcs ), 1 )
167+
168+ built_func = funcs [0 ]
169+ bindings = built_func .get_bindings ()
170+ self .assertEqual (len (bindings ), 1 )
171+
172+ trigger_dict = bindings [0 ].get_dict_repr ()
166173 self .assertEqual (trigger_dict ['type' ], 'connectorTrigger' )
167174 self .assertEqual (trigger_dict ['customField' ], 'custom_value' )
168175 self .assertEqual (trigger_dict ['anotherProperty' ], 123 )
0 commit comments