595
595
self.assertTrue(is_sym_link_broken(victim_link_file_path))
598
class UpgraderMiscTests(UbuntuCoreUpgraderTestCase):
600
def common_removed_file_test(self, contents):
602
Common code to test for an invalid removed file.
604
The contents parameter specifies the contents of the removed
607
file = 'created-regular-file'
609
create_file(self.update.removed_file, contents)
611
file_path = os.path.join(self.update.system_dir, file)
612
create_file(file_path, 'foo bar')
614
archive = self.update.create_archive(self.TARFILE)
615
self.assertTrue(os.path.exists(archive))
617
cmd_file = os.path.join(self.update.tmp_dir, CMD_FILE)
618
make_command_file(cmd_file, [self.TARFILE])
620
file_path = os.path.join(self.victim_dir, file)
621
self.assertFalse(os.path.exists(file_path))
623
# XXX: There is an implicit test here since if the upgrader
624
# fails (as documented on LP: #1437225), this test will also
626
call_upgrader(cmd_file, self.victim_dir, self.update)
628
self.assertTrue(os.path.exists(file_path))
630
# ensure the empty removed file hasn't removed the directory the
632
self.assertTrue(self.victim_dir)
634
def test_removed_file_empty(self):
636
Ensure the upgrader ignores an empty 'removed' file.
638
self.common_removed_file_test('')
640
def test_removed_file_space(self):
642
Ensure the upgrader handles a 'removed' file containing just a
645
self.common_removed_file_test(' ')
647
def test_removed_file_nl(self):
649
Ensure the upgrader handles a 'removed' file containing just a
652
self.common_removed_file_test('\n')