def test_callback(self): for attr in dir(self): if not attr.startswith('entries') or 'fail' in attr: continue e = getattr(self, attr) if not isinstance(e, dict): continue img, cset = self.generic_unmerge_bits(e) s = set(contents.offset_rewriter(img, cset)) ops.unmerge_contents(cset, offset=img, callback=s.remove) self.assertFalse(s, s)
def test_lingering_file(self): img, cset = self.generic_unmerge_bits(self.entries_norm1) dirs = [k for k, v in self.entries_norm1.iteritems() if v[0] == "dir"] fp = os.path.join(img, dirs[0], "linger") open(fp, "w").close() self.assertTrue(ops.unmerge_contents(cset, offset=img)) self.assertTrue(os.path.exists(fp))
def test_exact_removal(self): img, cset = self.generic_unmerge_bits(self.entries_norm1) self.assertTrue(ops.unmerge_contents(cset, offset=img)) self.assertFalse(livefs.scan(img, offset=img))
def test_empty_removal(self): img, cset = self.generic_unmerge_bits(self.entries_norm1) self.assertTrue( ops.unmerge_contents(cset, offset=os.path.join(self.dir, "dest")))