def test_resolve_deps(self):
        repo = mock.Mock(spec=Repository)
        repo.working_dir = "/tmp/test_resolve_deps"
        repo.id = "test_resolve_deps"

        unit_key_a = {'id' : '','name' :'pulp-server', 'version' :'0.0.309', 'release' : '1.fc17', 'epoch':'0', 'arch' : 'noarch', 'checksumtype' : 'sha256',
                      'checksum': 'ee5afa0aaf8bd2130b7f4a9b35f4178336c72e95358dd33bda8acaa5f28ea6e9', 'type_id' : 'rpm'}

        unit_key_a_obj = Unit(RPM_TYPE_ID, unit_key_a, {}, '')
        unit_key_a_obj.metadata = constants.PULP_SERVER_RPM_METADATA
        unit_key_b = {'id' : '', 'name' :'pulp-rpm-server', 'version' :'0.0.309', 'release' :'1.fc17', 'epoch':'0','arch' : 'noarch', 'checksumtype' :'sha256',
                      'checksum': '1e6c3a3bae26423fe49d26930b986e5f5ee25523c13f875dfcd4bf80f770bf56', 'type_id' : 'rpm', }

        unit_key_b_obj = Unit(RPM_TYPE_ID, unit_key_b, {}, '')
        unit_key_b_obj.metadata = constants.PULP_RPM_SERVER_RPM_METADATA
        existing_units = []
        for unit in [unit_key_a_obj, unit_key_b_obj]:
            existing_units.append(unit)
        conduit = importer_mocks.get_dependency_conduit(type_id=RPM_TYPE_ID, existing_units=existing_units, pkg_dir=self.pkg_dir)
        config = importer_mocks.get_basic_config()
        importer = YumImporter()
        units = [Unit(RPM_TYPE_ID, unit_key_b, {}, '')]
        result = importer.resolve_dependencies(repo, units, conduit, config)
        self.assertEqual(len(list(itertools.chain(*result['resolved'].values()))), 1)
        self.assertEqual(len(list(itertools.chain(*result['unresolved'].values()))), 0)
Exemplo n.º 2
0
    def existing_units(self):
        units = []
#        for unit in [self.UNIT_KEY_A, self.UNIT_KEY_B]:
#            unit = Unit(TYPE_ID_RPM, unit, {}, '')
#            units.append(unit)

        unit = Unit(TYPE_ID_RPM, self.UNIT_KEY_A, {}, '')
        unit.metadata = constants.PULP_SERVER_RPM_METADATA
        units.append(unit)

        unit = Unit(TYPE_ID_RPM, self.UNIT_KEY_B, {}, '')
        unit.metadata = constants.PULP_RPM_SERVER_RPM_METADATA
        units.append(unit)
        return units