def test_srm_download_to_file(): srm_file = StringIO() local_file = StringIO() srm_file.write('content') srm_file.seek(0) with gfal2.mocked_gfal2(dumper, files={'srm://example.com/file': srm_file}): dumper.srm_download_to_file('srm://example.com/file', local_file) local_file.seek(0) eq_(local_file.read(), 'content')
def test_srm_download_creates_file_with_content(): srm_file = StringIO() local_file = StringIO() srm_file.write('content') srm_file.seek(0) with gfal2.mocked_gfal2(dumper, files={'srm://example.com/file': srm_file}): with mock_open(dumper, local_file): dumper.srm_download('srm://example.com/file', 'filename') local_file.seek(0) eq_(local_file.read(), 'content')