def test__filter_missing_isos_available_isos(self): """ Test that when there are units in Pulp that match those in the manifest, but that are not currently associated with the repository, they are returned by _filter_missing_isos as the second list in the 3-tuple. """ # Let's put all three mammajammas in the manifest manifest = ['%s,%s,%s' % (iso.unit_key['name'], iso.unit_key['checksum'], iso.unit_key['size']) for iso in self.existing_units] manifest = '\n'.join(manifest) manifest = StringIO(manifest) manifest = models.ISOManifest(manifest, 'http://test.com') # Set up the sync conduit to return all three units as units in Pulp, but only the first # is associated with the repository sync_conduit = importer_mocks.get_sync_conduit(pkg_dir=self.pkg_dir, existing_units=[self.existing_units[0]], pulp_units=self.existing_units) iso_sync_run = ISOSyncRun(sync_conduit, self.config) filtered_isos = iso_sync_run._filter_missing_isos(manifest) local_missing_isos, local_available_isos, remote_missing_isos = filtered_isos # Everything except the first unit should be in the list of local available isos self.assertEqual(0, len(local_missing_isos)) self.assertEqual(2, len(local_available_isos)) for expected, actual in zip(sorted(self.existing_units[1:]), sorted(local_available_isos)): self.assertEqual(expected, actual)