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_write(self):
     """ Cannot write in /bin (dont run this test as root please !) ==> StorageServiceException """
     with self.assertRaises(StorageServiceException):
         storage = FilesystemStorageService("/bin")
         storage.write("foo", "bar")
 def test_cannot_write(self):
     """ Cannot write in /bin (dont run this test as root please !) ==> StorageServiceException """
     with self.assertRaises(StorageServiceException):
         storage = FilesystemStorageService("/bin")
         storage.write("foo", "bar")