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 2021/01/06 06:02:12 UTC

[GitHub] [airflow] weldpua2008 commented on a change in pull request #13049: Add S3KeySizeSensor

weldpua2008 commented on a change in pull request #13049:
URL: https://github.com/apache/airflow/pull/13049#discussion_r552386100



##########
File path: tests/providers/amazon/aws/sensors/test_s3_key.py
##########
@@ -121,3 +121,50 @@ def test_poke_wildcard(self, mock_hook):
 
         mock_check_for_wildcard_key.return_value = True
         self.assertTrue(op.poke(None))
+
+
+class TestS3KeySizeSensor(unittest.TestCase):
+    @mock.patch('airflow.providers.amazon.aws.sensors.s3_key.S3Hook')
+    def test_poke_check_for_key_false(self, mock_hook):
+        op = S3KeySizeSensor(task_id='s3_key_sensor', bucket_key='s3://test_bucket/file')
+
+        mock_check_for_key = mock_hook.return_value.check_for_key
+        mock_check_for_key.return_value = False
+        self.assertFalse(op.poke(None))
+        mock_check_for_key.assert_called_once_with(op.bucket_key, op.bucket_name)

Review comment:
       I have updated




----------------------------------------------------------------
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