def test_TemporaryVolume_host_path_is_temporary_directory(): with mock.patch('girder_worker.docker.transforms.tempfile.mkdtemp', return_value='/bogus/path'): tv = TemporaryVolume() assert tv.host_path is None tv.transform() assert tv.host_path == '/bogus/path'
def test_TemporaryVolume_transform_creates_container_path(): with mock.patch('girder_worker.docker.transforms.uuid.uuid4', return_value=mock.Mock(hex='SOME_UUID')): tv = TemporaryVolume() assert tv.container_path is None assert tv.transform() == '{}/SOME_UUID'.format(TEMP_VOLUME_MOUNT_PREFIX) assert tv.container_path == '{}/SOME_UUID'.format(TEMP_VOLUME_MOUNT_PREFIX)