def test_disk_store_alt_name_relpath():
 with TestConfig(DISK_TEST_CONFIG) as (directory, object_store):
  empty_dataset = MockDataset(1)
  directory.write('', 'files1/000/dataset_1.dat')
  directory.write('foo', 'foo.txt')
  try:
   assert (object_store.get_data(empty_dataset, extra_dir='dataset_1_files', alt_name='../../../foo.txt') != 'foo')
  except ObjectInvalid:
   pass

def test_disk_store_alt_name_relpath ( ) : with TestConfig ( DISK_TEST_CONFIG ) as ( directory , object_store ) : empty_dataset = MockDataset ( 1 ) directory . write ( '' , 'files1/000/dataset_1.dat' ) directory . write ( 'foo' , 'foo.txt' ) try : assert ( object_store . get_data ( empty_dataset , extra_dir = 'dataset_1_files' , alt_name = '../../../foo.txt' ) != 'foo' ) except ObjectInvalid : pass
test that alt_name cannot be used to access arbitrary paths using a relative path .