示例#1
0
 def test_save_objects(self):
     objs = [self.obj1, self.obj2]
     storage.save_objects(self.path, self.extension, objs)
     for obj, data in zip(objs, [self.d1, self.d2]):
         # TODO Ideally the below would work without calling convert.
         path = "%s/%s%s" % (self.path, convert.uuid_to_base32(obj.uuid), self.extension)
         self.assertTrue(os.path.exists(path))
         loaded_data = storage.load(path)
         self.assertDictEqual(data, loaded_data)
示例#2
0
 def test_save_and_load_keeps_data_intact(self):
     storage.save(self.path, self.d1)
     d2 = storage.load(self.path)
     self.assertDictEqual(self.d1, d2)
示例#3
0
 def test_save_object(self):
     storage.save_object(self.path, self.obj)
     self.assertTrue(os.path.exists(self.path))
     data = storage.load(self.path)
     self.assertDictEqual(data, self.d1)