def test_create_object(self):
     rpm_file = create_rpm_file_object('tree-1.5-12.noarch.rpm')
     self.assertEquals('tree-1.5-12.noarch.rpm', rpm_file.file_name)
     self.assertEquals('tree', rpm_file.name)
     self.assertEquals('1.5', rpm_file.version)
     self.assertEquals('12', rpm_file.release)
     self.assertEquals('noarch', rpm_file.architecture)
 def test_create_object(self):
     rpm_file = create_rpm_file_object('tree-1.5-12.noarch.rpm')
     self.assertEquals('tree-1.5-12.noarch.rpm', rpm_file.file_name)
     self.assertEquals('tree', rpm_file.name)
     self.assertEquals('1.5', rpm_file.version)
     self.assertEquals('12', rpm_file.release)
     self.assertEquals('noarch', rpm_file.architecture)
Exemple #3
0
    def _determine_rpm_file_name(self, directory, rpm):
        if create_rpm_file_object(rpm) is None:
            latest_rpm = self.rpmService.get_latest_rpm(rpm, directory)

            if latest_rpm is None:
                raise PropagationException("Package for {0} could not be found in {1}".format(rpm, directory))

            return latest_rpm

        return rpm
    def test_returns_none_on_invalid_rpm_names(self):
        invalid_rpms = [
            '.rpm', 'noarch.rpm', 'tree', 'tree-1.2.noarch.rpm',
            'tree-1.2-23.rpm'
        ]

        invalid_names_not_found = []
        for invalid_name in invalid_rpms:
            try:
                if create_rpm_file_object(invalid_name) is not None:
                    invalid_names_not_found.append(invalid_name)
            except:
                invalid_names_not_found.append(invalid_name)

        self.assertEquals(
            0, len(invalid_names_not_found),
            'the following rpms were not detected as invalid: %s ' %
            invalid_names_not_found)
 def test_returns_none_on_invalid_rpm_names(self):
     invalid_rpms = ['.rpm',
             'noarch.rpm',
             'tree',
             'tree-1.2.noarch.rpm',
             'tree-1.2-23.rpm'
         ]
     
     invalid_names_not_found = []
     for invalid_name in invalid_rpms:
         try:
             if create_rpm_file_object(invalid_name) is not None:
                 invalid_names_not_found.append(invalid_name)
         except:
             invalid_names_not_found.append(invalid_name)
     
     self.assertEquals(0, len(invalid_names_not_found),
                       'the following rpms were not detected as invalid: %s ' % invalid_names_not_found)