From b7679c10ced5431680b805f194f5c114c09821af Mon Sep 17 00:00:00 2001 From: Sharon Goliath Date: Mon, 16 Sep 2024 11:28:39 -0700 Subject: [PATCH] CADC-13477 - code review comments. --- caom2utils/caom2utils/tests/test_data_util.py | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/caom2utils/caom2utils/tests/test_data_util.py b/caom2utils/caom2utils/tests/test_data_util.py index 67e08a7d..cbb5ad04 100644 --- a/caom2utils/caom2utils/tests/test_data_util.py +++ b/caom2utils/caom2utils/tests/test_data_util.py @@ -107,21 +107,22 @@ def test_get_file_type(): def test_storage_inventory_client(cadc_client_mock): test_subject = Mock(autospec=True) test_uri = 'cadc:TEST/test_file.fits' + + def info_si_mock(ignore): + return FileInfo(id=test_uri, file_type='application/fits', md5sum='abc', size=42) + + def get_si_mock(ignore2, dest, **kwargs): + fhead = kwargs.get('fhead') + if fhead: + dest.write(TEST_HEADERS) + else: + test_fqn.write_text('StorageInventoryClient') + for test_working_directory in [Path(test_fits2caom2.TESTDATA_DIR), Path('./')]: test_fqn = test_working_directory / 'test_file.fits' if test_fqn.exists(): test_fqn.unlink() - def info_si_mock(ignore): - return FileInfo(id=test_uri, file_type='application/fits', md5sum='abc', size=42) - - def get_si_mock(ignore2, dest, **kwargs): - fhead = kwargs.get('fhead') - if fhead: - dest.write(TEST_HEADERS) - else: - test_fqn.write_text('StorageInventoryClient') - cadc_client_mock.return_value.cadcinfo.side_effect = info_si_mock cadc_client_mock.return_value.cadcget.side_effect = get_si_mock cadc_client_mock.return_value.cadcput = Mock(autospec=True)