This is an automated email from the ASF dual-hosted git repository.
eamonford pushed a commit to branch tests
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-ingester.git
The following commit(s) were added to refs/heads/tests by this push:
new e51b7ad unit tests
e51b7ad is described below
commit e51b7adcabe606e6f65fc4fbc9c863df41ca54a8
Author: Eamon Ford <[email protected]>
AuthorDate: Wed Jun 10 18:06:33 2020 -0700
unit tests
---
.../tests/services/test_CollectionProcessor.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/collection_manager/tests/services/test_CollectionProcessor.py
b/collection_manager/tests/services/test_CollectionProcessor.py
index ea7d0d0..c95821d 100644
--- a/collection_manager/tests/services/test_CollectionProcessor.py
+++ b/collection_manager/tests/services/test_CollectionProcessor.py
@@ -19,15 +19,17 @@ class TestCollectionProcessor(unittest.TestCase):
def test_file_supported_with_foo(self):
self.assertFalse(CollectionProcessor._file_supported("test_dir/test_granule.foo"))
- def test_get_history_manager_returns_same_object(self):
+ @mock.patch('collection_manager.services.MessagePublisher', autospec=True)
+ def test_get_history_manager_returns_same_object(self, mock_publisher):
with tempfile.TemporaryDirectory() as history_dir:
- collection_processor = CollectionProcessor(None,
FileIngestionHistoryBuilder(history_dir))
+ collection_processor = CollectionProcessor(mock_publisher,
FileIngestionHistoryBuilder(history_dir))
history_manager =
collection_processor._get_history_manager('dataset_id')
self.assertIs(collection_processor._get_history_manager('dataset_id'),
history_manager)
- def test_get_history_manager_returns_different_object(self):
+ @mock.patch('collection_manager.services.MessagePublisher', autospec=True)
+ def test_get_history_manager_returns_different_object(self,
mock_publisher):
with tempfile.TemporaryDirectory() as history_dir:
- collection_processor = CollectionProcessor(None,
FileIngestionHistoryBuilder(history_dir))
+ collection_processor = CollectionProcessor(mock_publisher,
FileIngestionHistoryBuilder(history_dir))
history_manager = collection_processor._get_history_manager('foo')
self.assertIsNot(collection_processor._get_history_manager('bar'),
history_manager)
@@ -98,7 +100,7 @@ class TestCollectionProcessor(unittest.TestCase):
date_from=None,
date_to=None)
- collection_processor.process_granule("test.nc", collection)
+ collection_processor.process_granule("test.h5", collection)
mock_publisher.publish_message.assert_called_with(body=mock.ANY,
priority=2)
mock_history.push.assert_called()