From c29e5c0d922a79a98d43baefa8ac1be560972644 Mon Sep 17 00:00:00 2001 From: Alok Saldanha Date: Thu, 22 Apr 2021 06:55:45 -0400 Subject: [PATCH] #45 implemented test__list_items__pass_filter_into_scan_directory --- tests/items/s3/test_s3item_source.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/items/s3/test_s3item_source.py b/tests/items/s3/test_s3item_source.py index 7b20adf..10b62ea 100644 --- a/tests/items/s3/test_s3item_source.py +++ b/tests/items/s3/test_s3item_source.py @@ -24,7 +24,7 @@ class TestScanDirectory(unittest.TestCase): ) @patch("s3fs.S3FileSystem") - def test__scan_directory__properly_recurses_suburls(self, s3func): + def test__GIVEN_multilevel_bucket_THEN_properly_recurses_suburls(self, s3func): class S3Mock: def exists(path): if path in [ @@ -154,5 +154,16 @@ class TestScanDirectory(unittest.TestCase): ) self.assertEqual(lvl2.branches, None) - def test__list_items__pass_filter_into_scan_directory(self): - pass + +class TestListItems(unittest.TestCase): + def test_GIVEN_filter_THEN_pass_filter_into_scan_directory(self): + source = S3ItemSource("my-bucket") + source.scan_directory = MagicMock() + tree = source.list_items("some-filter") + source.scan_directory.assert_called_once_with("some-filter") + + def test_GIVEN_no_filter_THEN_pass_empty_string_into_scan_directory(self): + source = S3ItemSource("my-bucket") + source.scan_directory = MagicMock() + tree = source.list_items() + source.scan_directory.assert_called_once_with("")