Exemplo n.º 1
0
 def test_empty_recycle_bin(self):
     """Unit test for empty_recycle_bin"""
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete = False)
         self.assert_ (isinstance(ret, (int, long)))
     if not common.destructive_tests('recycle bin'):
         return
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete = True)
         self.assert_ (isinstance(ret, (int, long)))
Exemplo n.º 2
0
 def test_empty_recycle_bin(self):
     """Unit test for empty_recycle_bin"""
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=False)
         self.assert_(isinstance(ret, (int, long)))
     if not common.destructive_tests('recycle bin'):
         return
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=True)
         self.assert_(isinstance(ret, (int, long)))
Exemplo n.º 3
0
 def test_get_recycle_bin(self):
     """Unit test for get_recycle_bin"""
     for f in get_recycle_bin():
         self.assert_(os.path.exists(extended_path(f)), f)
     if not common.destructive_tests('get_recycle_bin'):
         return
     put_files_into_recycle_bin()
     # clear recycle bin
     counter = 0
     for f in get_recycle_bin():
         counter += 1
         FileUtilities.delete(f)
     self.assert_(counter >= 3, 'deleted %d' % counter)
     # now it should be empty
     for f in get_recycle_bin():
         self.fail('recycle bin should be empty, but it is not')
Exemplo n.º 4
0
 def test_get_recycle_bin(self):
     """Unit test for get_recycle_bin"""
     for f in get_recycle_bin():
         self.assert_(os.path.exists(extended_path(f)), f)
     if not common.destructive_tests('get_recycle_bin'):
         return
     put_files_into_recycle_bin()
     # clear recycle bin
     counter = 0
     for f in get_recycle_bin():
         counter += 1
         FileUtilities.delete(f)
     self.assert_(counter >= 3, 'deleted %d' % counter)
     # now it should be empty
     for f in get_recycle_bin():
         self.fail('recycle bin should be empty, but it is not')
Exemplo n.º 5
0
    def test_CleanerML(self):
        """Unit test for class CleanerML"""
        if os.path.exists('./doc/example_cleaner.xml'):
            os.chdir('tests')
        xmlcleaner = CleanerML("../doc/example_cleaner.xml")

        self.assert_(isinstance(xmlcleaner, CleanerML))
        self.assert_(isinstance(xmlcleaner.cleaner, Cleaner.Cleaner))

        def run_all(really_delete):
            for (option_id, __name) in xmlcleaner.cleaner.get_options():
                for cmd in xmlcleaner.cleaner.get_commands(option_id):
                    for result in cmd.execute(really_delete):
                        common.validate_result(self, result, really_delete)

        # preview
        run_all(False)

        # really delete if user allows
        if common.destructive_tests('example_cleaner.xml'):
            run_all(True)
Exemplo n.º 6
0
 def test_empty_recycle_bin(self):
     """Unit test for empty_recycle_bin"""
     # check the function basically works
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=False)
         self.assert_(isinstance(ret, (int, long)))
     if not common.destructive_tests('recycle bin'):
         return
     # check it deletes files for fixed drives
     put_files_into_recycle_bin()
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=True)
         self.assert_(isinstance(ret, (int, long)))
     # check it deletes files for all drives
     put_files_into_recycle_bin()
     ret = empty_recycle_bin(None, really_delete=True)
     self.assert_(isinstance(ret, (int, long)))
     # Repeat two for reasons.
     # 1. Trying to empty an empty recycling bin can cause
     #    a 'catastrophic failure' error (handled in the function)
     # 2. It should show zero bytes were deleted
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=True)
         self.assertEqual(ret, 0)
Exemplo n.º 7
0
 def test_empty_recycle_bin(self):
     """Unit test for empty_recycle_bin"""
     # check the function basically works
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=False)
         self.assert_(isinstance(ret, (int, long)))
     if not common.destructive_tests('recycle bin'):
         return
     # check it deletes files for fixed drives
     put_files_into_recycle_bin()
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=True)
         self.assert_(isinstance(ret, (int, long)))
     # check it deletes files for all drives
     put_files_into_recycle_bin()
     ret = empty_recycle_bin(None, really_delete=True)
     self.assert_(isinstance(ret, (int, long)))
     # Repeat two for reasons.
     # 1. Trying to empty an empty recycling bin can cause
     #    a 'catastrophic failure' error (handled in the function)
     # 2. It should show zero bytes were deleted
     for drive in get_fixed_drives():
         ret = empty_recycle_bin(drive, really_delete=True)
         self.assertEqual(ret, 0)