Exemplo n.º 1
0
    def test_install_default(self):
        target_dir = os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID)
        d = DefaultStorageBackendFSAdapter(None, self.folder)
        d.install()

        self.assertEqual(IStorageInfo(self.folder).path, target_dir)
        self.assertTrue(os.path.exists(target_dir))
Exemplo n.º 2
0
    def test_install_default(self):
        target_dir = os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID)
        d = DefaultStorageBackendFSAdapter(None, self.folder)
        d.install()

        self.assertEqual(IStorageInfo(self.folder).path, target_dir)
        self.assertTrue(os.path.exists(target_dir))
Exemplo n.º 3
0
    def test_acquire_success(self):
        d = DefaultStorageBackendFSAdapter(None, self.folder)
        d.install()

        target_dir = os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID)
        self.assertEqual(IStorageInfo(self.folder).path, target_dir)
        self.assertEqual(d.acquire(), target_dir)

        # remove the target dir.
        shutil.rmtree(target_dir)
        with self.assertRaises(ValueError):
            d.acquire()
Exemplo n.º 4
0
    def test_acquire_success(self):
        d = DefaultStorageBackendFSAdapter(None, self.folder)
        d.install()

        target_dir = os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID)
        self.assertEqual(IStorageInfo(self.folder).path, target_dir)
        self.assertEqual(d.acquire(), target_dir)

        # remove the target dir.
        shutil.rmtree(target_dir)
        with self.assertRaises(ValueError):
            d.acquire()
Exemplo n.º 5
0
    def test_install_exists(self):
        # create blocking dir.
        os.makedirs(os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID))

        target_dir = os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID + '-1')
        d = DefaultStorageBackendFSAdapter(None, self.folder)
        d.install()
        self.assertEqual(IStorageInfo(self.folder).path, target_dir)
        self.assertTrue(os.path.exists(target_dir))

        # doesn't go ahead and create extra directories.
        self.assertFalse(os.path.exists(
            os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID + '-2')))
Exemplo n.º 6
0
    def test_install_exists(self):
        # create blocking dir.
        os.makedirs(os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID))

        target_dir = os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID + '-1')
        d = DefaultStorageBackendFSAdapter(None, self.folder)
        d.install()
        self.assertEqual(IStorageInfo(self.folder).path, target_dir)
        self.assertTrue(os.path.exists(target_dir))

        # doesn't go ahead and create extra directories.
        self.assertFalse(
            os.path.exists(
                os.path.join(self.tempdir, 'plone', TEST_FOLDER_ID + '-2')))