def test_read_write_delete(self):
        """ Standard read / write /delete sequence that should succeed """
        storage = FilesystemStorageService(ROOT_STORAGE_DIR)
        self.assertTrue(os.path.exists(ROOT_STORAGE_DIR))

        storage.write(WRITTEN_FILE, FILE_CONTENT)
        full_file_path = os.path.join(ROOT_STORAGE_DIR, WRITTEN_FILE)
        self.assertTrue(os.path.exists(full_file_path))

        buf = storage.read(WRITTEN_FILE)
        self.assertEquals(FILE_CONTENT, buf)

        storage.delete(WRITTEN_FILE)
        self.assertFalse(os.path.exists(full_file_path))
    def test_read_write_delete(self):
        """ Standard read / write /delete sequence that should succeed """
        storage = FilesystemStorageService(ROOT_STORAGE_DIR)
        self.assertTrue(os.path.exists(ROOT_STORAGE_DIR))

        storage.write(WRITTEN_FILE, FILE_CONTENT)
        full_file_path = os.path.join(ROOT_STORAGE_DIR, WRITTEN_FILE)
        self.assertTrue(os.path.exists(full_file_path))

        buf = storage.read(WRITTEN_FILE)
        self.assertEquals(FILE_CONTENT, buf)

        storage.delete(WRITTEN_FILE)
        self.assertFalse(os.path.exists(full_file_path))
 def test_cannot_delete(self):
     """ Try to delete a file that does not exist => StorageServiceException """
     with self.assertRaises(StorageServiceException):
         storage = FilesystemStorageService(ROOT_STORAGE_DIR)
         storage.delete(WRITTEN_FILE)
 def test_cannot_delete(self):
     """ Try to delete a file that does not exist => StorageServiceException """
     with self.assertRaises(StorageServiceException):
         storage = FilesystemStorageService(ROOT_STORAGE_DIR)
         storage.delete(WRITTEN_FILE)