def test_ParseLineSymlink(self): pm = pkgmap.Pkgmap(PKGMAP_2.splitlines()) line = ( "1 s none " "/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5=libpq.so.5.3") # s none /opt/csw/lib/sparcv9/libpq.so.5=..//sparcv9/libpq.so.5 # s none /opt/csw/lib/sparcv9/libpq.so.5.3=..//sparcv9/libpq.so.5.3 line_to_add = ( "/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5 --> " "libpq.so.5.3") entry = { 'group': None, 'target': '/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5.3', 'user': None, 'path': '/opt/csw/lib/postgresql/9.0/lib/sparcv9/libpq.so.5', 'line': ('1 s none /opt/csw/lib/postgresql/9.0/lib/sparcv9/' 'libpq.so.5=libpq.so.5.3'), 'type': 's', 'class': 'none', 'mode': None, } self.assertEqual((entry, line_to_add), pm._ParseLine(line))
def test_1(self): pm = pkgmap.Pkgmap(PKGMAP_1.splitlines()) expected = [{ 'group': 'bin', 'user': '******', 'path': '/etc/opt/csw/cups/cupsd.conf.CSW', 'line': '1 f cswcpsampleconf /etc/opt/csw/cups/cupsd.conf.CSW 0644 root bin 4053 20987 1264420689', 'type': 'f', 'class': 'cswcpsampleconf', 'mode': '0644', 'target': None, }] self.assertEqual(expected, pm.entries)
def GetPkgmap(self, analyze_permissions=False, strip=None): fd = open(os.path.join(self.directory, "pkgmap"), "r") basedir = self.GetBasedir() return pkgmap.Pkgmap(fd, analyze_permissions, strip, basedir)
def testPkgmapSortedByPaths(self): pm = pkgmap.Pkgmap(PKGMAP_2.splitlines()) paths = [x["path"] for x in pm.entries] self.assertEquals(paths, sorted(paths))
def test_4(self): pm = pkgmap.Pkgmap(PKGMAP_3.splitlines()) self.assertTrue("build" in pm.entries_by_class)
def test_3(self): pm = pkgmap.Pkgmap(PKGMAP_2.splitlines()) self.assertTrue("cswcpsampleconf" in pm.entries_by_class)
def test_2(self): pm = pkgmap.Pkgmap(PKGMAP_2.splitlines()) line = ": 1 18128" self.assertTrue(line in pm.entries_by_line)