def test_disk_store_alt_name_abspath():
 with TestConfig(DISK_TEST_CONFIG) as (directory, object_store):
  empty_dataset = MockDataset(1)
  directory.write('', 'files1/000/dataset_1.dat')
  absfoo = os.path.abspath(os.path.join(directory.temp_directory, 'foo.txt'))
  with open(absfoo, 'w') as f:
   f.write('foo')
  try:
   assert (object_store.get_data(empty_dataset, extra_dir='dataset_1_files', alt_name=absfoo) != 'foo')
  except ObjectInvalid:
   pass

def test_disk_store_alt_name_abspath ( ) : with TestConfig ( DISK_TEST_CONFIG ) as ( directory , object_store ) : empty_dataset = MockDataset ( 1 ) directory . write ( '' , 'files1/000/dataset_1.dat' ) absfoo = os . path . abspath ( os . path . join ( directory . temp_directory , 'foo.txt' ) ) with open ( absfoo , 'w' ) as f : f . write ( 'foo' ) try : assert ( object_store . get_data ( empty_dataset , extra_dir = 'dataset_1_files' , alt_name = absfoo ) != 'foo' ) except ObjectInvalid : pass
test that alt_name cannot be used to access arbitrary paths using a absolute path .