You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/11/18 09:12:37 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #12389: [AIRFLOW-5115] Bugfix for S3KeySensor failing to accept template_fields

potiuk commented on a change in pull request #12389:
URL: https://github.com/apache/airflow/pull/12389#discussion_r525924946



##########
File path: tests/providers/amazon/aws/sensors/test_s3_key.py
##########
@@ -32,32 +32,40 @@ def test_bucket_name_none_and_bucket_key_as_relative_path(self):
         and bucket_key is provided as relative path rather than s3:// url.
         :return:
         """
+        op = S3KeySensor(task_id='s3_key_sensor', bucket_key="file_in_bucket")
         with self.assertRaises(AirflowException):
-            S3KeySensor(task_id='s3_key_sensor', bucket_key="file_in_bucket")
+            op.poke(None)
 
     def test_bucket_name_provided_and_bucket_key_is_s3_url(self):
         """
         Test if exception is raised when bucket_name is provided
         while bucket_key is provided as a full s3:// url.
         :return:
         """
+        op = S3KeySensor(
+            task_id='s3_key_sensor', bucket_key="s3://test_bucket/file", bucket_name='test_bucket'
+        )
         with self.assertRaises(AirflowException):
-            S3KeySensor(
-                task_id='s3_key_sensor', bucket_key="s3://test_bucket/file", bucket_name='test_bucket'
-            )
+            op.poke(None)
 
     @parameterized.expand(
         [
             ['s3://bucket/key', None, 'key', 'bucket'],
             ['key', 'bucket', 'key', 'bucket'],
         ]
     )
-    def test_parse_bucket_key(self, key, bucket, parsed_key, parsed_bucket):
+    @mock.patch('airflow.providers.amazon.aws.sensors.s3_key.S3Hook')

Review comment:
       Would you mind adding a test with JINJA template in ? I think that woudl be an ultimate test here :).




----------------------------------------------------------------
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:
users@infra.apache.org