Example #1
0
    def test_clear_dir_no_dir(self):
        directory = os.path.join(self.fs.mount_point, "project2")
        if os.path.exists(directory):
            shutil.rmtree(directory)

        with self.assertRaises(exceptions.ValidationError):
            p = Project(file_system=self.fs, directory="project2")
            p.clear_dir()
Example #2
0
    def test_clear_dir_no_mount_point_chmod(self):
        directory = os.path.join(self.fs.mount_point, "project2")
        if not os.path.exists(directory):
            os.makedirs(directory)
        os.mkdir(os.path.join(directory, "something"))
        os.chmod(self.fs.mount_point, 02444)

        with self.assertRaises(exceptions.ValidationError):
            p = Project(file_system=self.fs, directory="project2")
            p.clear_dir()
Example #3
0
    def test_clear_dir(self):
        directory = os.path.join(self.fs.mount_point, "project2")
        if not os.path.exists(directory):
            os.makedirs(directory)

        project2 = Project(file_system=self.fs, directory="project2")

        try:
            project2.clear_dir()
        except (IOError, OSError, exceptions.ValidationError) as e:
            logger.error(e)
            self.fail(e)