コード例 #1
0
    def test_check_sanity(self):
        pri = fil = oth = MetadataMock(checksums=('aaa', 'bbb'))
        repo = OneRepo(pri, fil, oth)
        self.assertTrue(repo.check_sanity())

        pri = fil = MetadataMock(checksums=('aaa', 'bbb'))
        oth = MetadataMock(checksums=('aaa'))
        repo = OneRepo(pri, fil, oth)
        self.assertFalse(repo.check_sanity())

        pri = oth = MetadataMock(checksums=('aaa', 'bbb'))
        fil = MetadataMock(checksums=('aaa'))
        repo = OneRepo(pri, fil, oth)
        self.assertFalse(repo.check_sanity())
コード例 #2
0
    def test_check_sanity(self):
        # Repos are same
        checksums = set(['123', '456'])
        packages = set(['abc', 'def'])
        xmlpri = xmlfil = xmloth = MetadataMock(checksums=checksums,
                                                packages=packages)
        xmlrepo = OneRepo(xmlpri, xmlfil, xmloth)
        sqlpri = sqlfil = sqloth = MetadataMock(checksums=checksums,
                                                packages=packages)
        sqlrepo = OneRepo(sqlpri, sqlfil, sqloth)
        repo = CompleteRepo(xmlrepo, sqlrepo)
        self.assertTrue(repo.check_sanity())

        # XML repo is not sane
        checksums = set(['123', '456'])
        packages = set(['abc', 'def'])
        xmlpri = MetadataMock(checksums=set(['123', '789']), packages=packages)
        xmlfil = xmloth = MetadataMock(checksums=checksums, packages=packages)
        xmlrepo = OneRepo(xmlpri, xmlfil, xmloth)
        sqlpri = sqlfil = sqloth = MetadataMock(checksums=checksums,
                                                packages=packages)
        sqlrepo = OneRepo(sqlpri, sqlfil, sqloth)
        repo = CompleteRepo(xmlrepo, sqlrepo)
        self.assertFalse(repo.check_sanity())

        # Sqlite repo is not sane
        checksums = set(['123', '456'])
        packages = set(['abc', 'def'])
        xmlpri = xmlfil = xmloth = MetadataMock(checksums=checksums,
                                                packages=packages)
        xmlrepo = OneRepo(xmlpri, xmlfil, xmloth)
        sqlpri = MetadataMock(checksums=set(['123', '789']), packages=packages)
        sqlfil = sqloth = MetadataMock(checksums=checksums, packages=packages)
        sqlrepo = OneRepo(sqlpri, sqlfil, sqloth)
        repo = CompleteRepo(xmlrepo, sqlrepo)
        self.assertFalse(repo.check_sanity())

        # Sqlite and xml is different
        packages = set(['abc', 'def'])
        xmlpri = xmlfil = xmloth = MetadataMock(checksums=set(['123', '456']),
                                                packages=packages)
        xmlrepo = OneRepo(xmlpri, xmlfil, xmloth)
        sqlpri = sqlfil = sqloth = MetadataMock(checksums=set(['123', '789']),
                                                packages=packages)
        sqlrepo = OneRepo(sqlpri, sqlfil, sqloth)
        repo = CompleteRepo(xmlrepo, sqlrepo)
        self.assertFalse(repo.check_sanity())
コード例 #3
0
ファイル: test_repo.py プロジェクト: Tojaj/yum-metadata-diff
    def test_check_sanity(self):
        pri = fil = oth = MetadataMock(checksums=('aaa', 'bbb'))
        repo = OneRepo(pri, fil, oth)
        self.assertTrue(repo.check_sanity())

        pri = fil = MetadataMock(checksums=('aaa', 'bbb'))
        oth = MetadataMock(checksums=('aaa'))
        repo = OneRepo(pri, fil, oth)
        self.assertFalse(repo.check_sanity())

        pri = oth = MetadataMock(checksums=('aaa', 'bbb'))
        fil = MetadataMock(checksums=('aaa'))
        repo = OneRepo(pri, fil, oth)
        self.assertFalse(repo.check_sanity())
コード例 #4
0
 def test_checksums(self):
     checksums = set(('abc', 'efg'))
     pri = MetadataMock(checksums=checksums)
     repo = OneRepo(pri, None, None)
     self.assertEqual(repo.checksums(), checksums)
コード例 #5
0
 def test_packages(self):
     packages = set(('a', 'b'))
     pri = MetadataMock(packages=packages)
     repo = OneRepo(pri, None, None)
     self.assertEqual(repo.packages(), packages)
コード例 #6
0
ファイル: test_repo.py プロジェクト: Tojaj/yum-metadata-diff
 def test_checksums(self):
     checksums = set(('abc', 'efg'))
     pri = MetadataMock(checksums=checksums)
     repo = OneRepo(pri, None, None)
     self.assertEqual(repo.checksums(), checksums)
コード例 #7
0
ファイル: test_repo.py プロジェクト: Tojaj/yum-metadata-diff
 def test_packages(self):
     packages = set(('a', 'b'))
     pri = MetadataMock(packages=packages)
     repo = OneRepo(pri, None, None)
     self.assertEqual(repo.packages(), packages)