mik-laj commented on issue #4846: [AIRFLOW-4030] adding start to singularity for airflow URL: https://github.com/apache/airflow/pull/4846#issuecomment-470738564 @vsoch Yes. You understand well. Example: ```python @mock.patch('airflow.contrib.hooks.gcp_vision_hook.CloudVisionHook.get_conn') def test_add_product_to_product_set(self, get_conn): # Given add_product_to_product_set_method = get_conn.return_value.add_product_to_product_set # When self.hook.add_product_to_product_set( product_set_id=PRODUCTSET_ID_TEST, product_id=PRODUCT_ID_TEST, location=LOC_ID_TEST, project_id=PROJECT_ID_TEST,. ) # Then # Product ID was provided explicitly in the method call above, should be returned from the method add_product_to_product_set_method.assert_called_once_with( name=PRODUCTSET_NAME_TEST, product=PRODUCT_NAME_TEST, retry=None, timeout=None, metadata=None ) ``` where `get_conn` is a method that return a authorised API client library. Source: https://github.com/apache/airflow/pull/4791/files As I look now, you have not created the hook. This is not required, but it is good practice to introduce an intermediate layer between the external library and the operator. This allows you to use the same code again. For example: My team create a integration with Google Translate, Google Speech, so we created a two operators: CloudTranslateOperator, CloudTextToSpeech and two hooks: CloudTranslateHook and CloudSpeechHook. In next step, we are working on improving the most common use cases, so we've created the new CloudTranslateAndSpeechOperator and no new hook. I do not demand Slack, but I just wanted to help you. Comments are okay for me.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services