Exemple #1
0
    def test_package_to_object(self):
        p1 = Package({'n': 'foo', 'e': '1', 'v': '1.2.3', 'r': '2', 'a': 'x86_64', 'z': Package.ACTION_EXCLUDE})
        p2 = Package({'n': 'foo', 'a': 'x86_64', 'z': Package.ACTION_EXCLUDE})
        self.assertEqual(p1.to_object(),
                         {'n': 'foo',
                          'e': '1',
                          'v': '1.2.3',
                          'r': '2',
                          'a': 'x86_64',
                          'z': Package.ACTION_EXCLUDE})

        self.assertEqual(p2.to_object(),
                         {'n': 'foo',
                          'a': 'x86_64',
                          'z': Package.ACTION_EXCLUDE})
Exemple #2
0
    def test_package_to_object(self):
        p1 = Package({'n': 'foo', 'e': '1', 'v': '1.2.3', 'r': '2', 'a': 'x86_64', 'z': Package.ACTION_EXCLUDE})
        p2 = Package({'n': 'foo', 'a': 'x86_64', 'z': Package.ACTION_EXCLUDE})
        self.assertEqual(p1.to_object(),
                         {'n': 'foo',
                          'e': '1',
                          'v': '1.2.3',
                          'r': '2',
                          'a': 'x86_64',
                          'z': Package.ACTION_EXCLUDE})

        self.assertEqual(p2.to_object(),
                         {'n': 'foo',
                          'a': 'x86_64',
                          'z': Package.ACTION_EXCLUDE})
Exemple #3
0
    def test_package_parse_empty(self):
        p1 = Package({})

        self.assertEqual(None, p1.name)
        self.assertEqual(None, p1.epoch)
        self.assertEqual(None, p1.version)
        self.assertEqual(None, p1.release)
        self.assertEqual(None, p1.arch)

        # empty packages will have a default action of include
        self.assertEqual({'z': 1}, p1.to_object())
Exemple #4
0
    def test_package_parse(self):
        p1 = Package({'n':'testpackage'})

        self.assertEqual('testpackage', p1.name)
        self.assertEqual(None, p1.epoch)
        self.assertEqual(None, p1.version)
        self.assertEqual(None, p1.release)
        self.assertEqual(None, p1.arch)

        # empty packages will have a default action of include
        self.assertEqual({'n':'testpackage', 'z': Package.ACTION_INCLUDE}, p1.to_object())