eilon246810 commented on code in PR #43045:
URL: https://github.com/apache/airflow/pull/43045#discussion_r1804717675


##########
providers/tests/apache/hdfs/sensors/test_web_hdfs.py:
##########
@@ -55,3 +58,41 @@ def 
test_poke_should_return_false_for_non_existing_table(self, mock_hook):
 
         
mock_hook.return_value.check_for_path.assert_called_once_with(hdfs_path=TEST_HDFS_PATH)
         mock_hook.assert_called_once_with(TEST_HDFS_CONN)
+
+
+class TestMultipleFilesWebHdfsSensor:
+    @mock.patch("airflow.providers.apache.hdfs.hooks.webhdfs.WebHDFSHook")
+    def test_poke(self, mock_hook):
+        mock_hook.return_value.get_conn.return_value.list.return_value = 
TEST_HDFS_FILENAMES
+
+        sensor = MultipleFilesWebHdfsSensor(
+            task_id="test_task",
+            webhdfs_conn_id=TEST_HDFS_CONN,
+            directory_path=TEST_HDFS_DIRECTORY,
+            expected_filenames=TEST_HDFS_FILENAMES
+        )
+        result = sensor.poke(dict())
+
+        assert result
+
+        
mock_hook.return_value.get_conn.return_value.list.assert_called_once_with(TEST_HDFS_DIRECTORY)
+        mock_hook.return_value.get_conn.assert_called_once()
+        mock_hook.assert_called_once_with(TEST_HDFS_CONN)
+
+    @mock.patch("airflow.providers.apache.hdfs.hooks.webhdfs.WebHDFSHook")
+    def test_poke_should_return_false_for_missing_file(self, mock_hook):
+        mock_hook.return_value.get_conn.return_value.list.return_value = 
TEST_HDFS_FILENAMES[0]
+
+        sensor = MultipleFilesWebHdfsSensor(
+            task_id="test_task",
+            webhdfs_conn_id=TEST_HDFS_CONN,
+            directory_path=TEST_HDFS_DIRECTORY,
+            expected_filenames=TEST_HDFS_FILENAMES
+        )
+        exists = sensor.poke(dict())
+
+        assert not exists
+
+        
mock_hook.return_value.get_conn.return_value.list.assert_called_once_with(TEST_HDFS_DIRECTORY)
+        mock_hook.return_value.get_conn.assert_called_once()
+        mock_hook.assert_called_once_with(TEST_HDFS_CONN)

Review Comment:
   Added! thanks



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to