示例#1
0
    def setUp(self):
        self.summ = pkgsummary.new_summary()
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')

        self.tmpdir = tempfile.mkdtemp()

        self.tmpfilename = os.path.join(self.tmpdir, "foo.json")
        pkgsummary.write_summary(self.summ, self.tmpfilename)
示例#2
0
    def setUp(self):
        self.summ = pkgsummary.new_summary()
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')

        self.tmpdir = tempfile.mkdtemp()

        self.tmpfilename = os.path.join(self.tmpdir, "foo.json")
        pkgsummary.write_summary(self.summ, self.tmpfilename)
示例#3
0
    def testSummMerge(self):
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')

        mergesumm = pkgsummary.new_summary()

        pkgsummary.merge_summary(mergesumm, self.summ)

        self.assertEqual(mergesumm['packages']['pkg']['dist'],
                         self.summ['packages']['pkg']['dist'])
        self.assertEqual(mergesumm['packages']['pkg']['dist'],
                         mergesumm['packages']['pkg']['overall'])
示例#4
0
    def testSummMerge(self):
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')

        mergesumm = pkgsummary.new_summary()

        pkgsummary.merge_summary(mergesumm, self.summ)

        self.assertEqual(mergesumm['packages']['pkg']['dist'],
                         self.summ['packages']['pkg']['dist'])
        self.assertEqual(mergesumm['packages']['pkg']['dist'],
                         mergesumm['packages']['pkg']['overall'])
示例#5
0
    def testSummAddArgValidation(self):
        with self.assertRaises(pkgsummary.SummaryException):
            pkgsummary.add_summary(self.summ, 'foodist', 'foopkg', 'Z', 0,
                                   'http://foo')
        with self.assertRaises(pkgsummary.SummaryException):
            pkgsummary.add_summary(self.summ, 'foodist', 'foopkg', 'X',
                                   'bogus', 'http://foo')
        with self.assertRaises(pkgsummary.SummaryException):
            pkgsummary.add_summary(self.summ, 'foodist', 'foopkg', 'X', 1,
                                   'ittp://foo')

        pkgsummary.add_summary(self.summ, 'foodist', 'foopkg', 'X', 1,
                               'http://foo')
示例#6
0
    def testSummAddBlockCount(self):
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'P', 1, 'http://foo')
        self.assertEqual(1, self.summ['packages']['pkg']['dist'][1])

        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'F', 2, 'http://foo')
        self.assertEqual(2, self.summ['packages']['pkg']['dist'][1])
示例#7
0
    def testSummAddBlockCount(self):
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'P', 1, 'http://foo')
        self.assertEqual(1, self.summ['packages']['pkg']['dist'][1])

        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'F', 2, 'http://foo')
        self.assertEqual(2, self.summ['packages']['pkg']['dist'][1])
示例#8
0
    def testSummAddArgValidation(self):
        with self.assertRaises(pkgsummary.SummaryException):
            pkgsummary.add_summary(
                        self.summ, 'foodist', 'foopkg', 'Z', 0, 'http://foo')
        with self.assertRaises(pkgsummary.SummaryException):
            pkgsummary.add_summary(
                        self.summ, 'foodist', 'foopkg', 'X', 'bogus',
                        'http://foo')
        with self.assertRaises(pkgsummary.SummaryException):
            pkgsummary.add_summary(
                        self.summ, 'foodist', 'foopkg', 'X', 1, 'ittp://foo')

        pkgsummary.add_summary(
                        self.summ, 'foodist', 'foopkg', 'X', 1, 'http://foo')
示例#9
0
    def testSummAddOverwriteFlag(self):
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'P', 0, 'http://foo2')
        self.assertEqual('X', self.summ['packages']['pkg']['dist'][0])
        self.assertEqual('http://foo', self.summ['packages']['pkg']['dist'][2])

        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'F', 0, 'http://foo3')
        self.assertEqual('F', self.summ['packages']['pkg']['dist'][0])
        self.assertEqual('http://foo3', self.summ['packages']['pkg']['dist'][2])
示例#10
0
    def testSummAddOverwriteFlag(self):
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')
        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'P', 0, 'http://foo2')
        self.assertEqual('X', self.summ['packages']['pkg']['dist'][0])
        self.assertEqual('http://foo', self.summ['packages']['pkg']['dist'][2])

        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'F', 0, 'http://foo3')
        self.assertEqual('F', self.summ['packages']['pkg']['dist'][0])
        self.assertEqual('http://foo3',
                         self.summ['packages']['pkg']['dist'][2])
示例#11
0
    def testSummAddArgStorageFormat(self):
        # store non-overlapping entries

        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')
        pkgsummary.add_summary(self.summ, 'dist', 'pkg2', 'W', 1,
                               'http://foo2')
        pkgsummary.add_summary(self.summ, 'dist2', 'pkg3', 'P', 2,
                               'http://foo3')
        self.assertEqual(['X', 0, 'http://foo'],
                         self.summ['packages']['pkg']['dist'])
        self.assertEqual(['W', 1, 'http://foo2'],
                         self.summ['packages']['pkg2']['dist'])
        self.assertEqual(['P', 2, 'http://foo3'],
                         self.summ['packages']['pkg3']['dist2'])
示例#12
0
    def testSummAddArgStorageFormat(self):
        # store non-overlapping entries

        pkgsummary.add_summary(self.summ, 'dist', 'pkg', 'X', 0, 'http://foo')
        pkgsummary.add_summary(
                     self.summ, 'dist', 'pkg2', 'W', 1, 'http://foo2')
        pkgsummary.add_summary(
                     self.summ, 'dist2', 'pkg3', 'P', 2, 'http://foo3')
        self.assertEqual(
                     ['X', 0, 'http://foo'],
                     self.summ['packages']['pkg']['dist'])
        self.assertEqual(
                     ['W', 1, 'http://foo2'],
                     self.summ['packages']['pkg2']['dist'])
        self.assertEqual(
                     ['P', 2, 'http://foo3'],
                     self.summ['packages']['pkg3']['dist2'])