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



##########
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)
+
+    @mock.patch('airflow.providers.amazon.aws.sensors.s3_key.S3Hook')
+    def test_poke_get_files_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_hook.return_value.check_for_key.return_value = True
+        mock_get_files = mock.Mock()
+        mock_get_files.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:
[email protected]


Reply via email to