def test_end_to_end_with_an_error(self):
        cmd = CmdDataRemove(self.settings)
        cmd.parsed_args.keep_in_cloud = True

        dir11_full = os.path.join('data', self.dir11)
        dir2_full = os.path.join('data', self.dir2)
        file6_full = os.path.join('data', self.file6)

        cmd.parsed_args.target = [dir11_full, self.file5, file6_full]
        cmd.parsed_args.recursive = True

        cmd.parsed_args.skip_git_actions = True

        self.assertTrue(os.path.exists(dir11_full))
        self.assertTrue(os.path.exists(self.file5))
        self.assertTrue(os.path.exists(dir2_full))
        self.assertTrue(os.path.exists(self.file1))
        self.assertTrue(os.path.exists(self.file6))

        self.assertFalse(cmd.remove_all_targets())

        self.assertFalse(os.path.exists(dir11_full))
        self.assertFalse(os.path.exists(self.file5))
        self.assertTrue(os.path.exists(dir2_full))
        self.assertTrue(os.path.exists(self.file1))
        self.assertTrue(os.path.exists(self.file6))
Пример #2
0
    def test(self):
        cmd = CmdDataRemove(self.settings)
        cmd.parsed_args.keep_in_cloud = True

        dir11_full = os.path.join(self._config.data_dir, self.dir11)
        dir2_full = os.path.join(self._config.data_dir, self.dir2)

        cmd.parsed_args.target = [dir11_full, self.file5]
        cmd.parsed_args.recursive = True

        cmd.parsed_args.no_git_actions = True

        self.assertTrue(os.path.exists(dir11_full))
        self.assertTrue(os.path.exists(self.file5))
        self.assertTrue(os.path.exists(dir2_full))
        self.assertTrue(os.path.exists(self.file1))
        self.assertTrue(os.path.exists(self.file6))

        self.assertTrue(cmd.remove_all_targets())

        self.assertFalse(os.path.exists(dir11_full))
        self.assertFalse(os.path.exists(self.file5))
        self.assertTrue(os.path.exists(dir2_full))
        self.assertTrue(os.path.exists(self.file1))