def test_report_success(self): config = StubConfiguration(get_local_connector(MockupApiProvider())) operations = { report_vapi_success: { 'input_type': StructType(report_vapi_success, {}), 'output_type': BooleanType(), 'errors': {}, 'input_value_validator_list': [], 'output_validator_list': [], 'task_type': TaskType.NONE, } } stub = ApiInterfaceStub('mockup_interface', config=config, operations=operations) self.assertEqual( stub.native_invoke(ctx=config.connector.new_context(), method_name=report_vapi_success, kwargs={}), True)
def test_report_unexpected_error(self): config = StubConfiguration(get_local_connector(MockupApiProvider())) operations = { nonexistent_method: { 'input_type': StructType(nonexistent_method, {}), 'output_type': BooleanType(), 'errors': { not_found: not_found_error_type }, 'input_value_validator_list': [], 'output_validator_list': [], 'task_type': TaskType.NONE, } } stub = ApiInterfaceStub('mockup_interface', config=config, operations=operations) self.assertRaises(VapiError, stub.native_invoke, config.connector.new_context(), nonexistent_method, {})