Skip to content

Commit

Permalink
CADC-13477 - code review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
SharonGoliath committed Sep 16, 2024
1 parent bf671c8 commit b7679c1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions caom2utils/caom2utils/tests/test_data_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b7679c1

Please sign in to comment.