def test_import_units__units_none(self): """ Make sure that when units=None, we import all units from the import_conduit. """ source_units = [Unit(ids.TYPE_ID_ISO, {'name': 'test.iso'}, {}, '/path/test.iso'), Unit(ids.TYPE_ID_ISO, {'name': 'test2.iso'}, {}, '/path/test2.iso'), Unit(ids.TYPE_ID_ISO, {'name': 'test3.iso'}, {}, '/path/test3.iso')] import_conduit = importer_mocks.get_import_conduit(source_units=source_units) # source_repo, dest_repo, and config aren't used by import_units, so we'll just set them to # None for simplicity. self.iso_importer.import_units(None, None, import_conduit, None, units=None) # There should have been four calls to the import_conduit. One to get_source_units(), and # three to associate units. # get_source_units should have a UnitAssociationCriteria that specified ISOs, so we'll # assert that behavior. self.assertEqual(len(import_conduit.get_source_units.call_args_list), 1) get_source_units_args = tuple(import_conduit.get_source_units.call_args_list[0])[1] self.assertEqual(get_source_units_args['criteria']['type_ids'], [ids.TYPE_ID_ISO]) # There are three Units, so there should be three calls to associate_unit since we didn't # pass which units we wanted to import. Let's make sure the three calls were made with the # correct Units. self.assertEqual(len(import_conduit.associate_unit.call_args_list), 3) expected_unit_names = ['test.iso', 'test2.iso', 'test3.iso'] actual_unit_names = [tuple(call)[0][0].unit_key['name'] \ for call in import_conduit.associate_unit.call_args_list] self.assertEqual(actual_unit_names, expected_unit_names)
def test_import_units__units_some(self): """ Make sure that when units are passed, we import only those units. """ source_units = [Unit(ids.TYPE_ID_ISO, {'name': 'test.iso'}, {}, '/path/test.iso'), Unit(ids.TYPE_ID_ISO, {'name': 'test2.iso'}, {}, '/path/test2.iso'), Unit(ids.TYPE_ID_ISO, {'name': 'test3.iso'}, {}, '/path/test3.iso')] import_conduit = importer_mocks.get_import_conduit(source_units=source_units) # source_repo, dest_repo, and config aren't used by import_units, so we'll just set them to # None for simplicity. Let's use test.iso and test3.iso, leaving out test2.iso. self.iso_importer.import_units(None, None, import_conduit, None, units=[source_units[i] for i in range(0, 3, 2)]) # There should have been two calls to the import_conduit. None to get_source_units(), and # two to associate units. self.assertEqual(len(import_conduit.get_source_units.call_args_list), 0) # There are two Units, so there should be two calls to associate_unit since we passed which # units we wanted to import. Let's make sure the two calls were made with the # correct Units. self.assertEqual(len(import_conduit.associate_unit.call_args_list), 2) expected_unit_names = ['test.iso', 'test3.iso'] actual_unit_names = [tuple(call)[0][0].unit_key['name'] \ for call in import_conduit.associate_unit.call_args_list] self.assertEqual(actual_unit_names, expected_unit_names)
def test_distribution_unit_import(self): existing_units = [] dunit_key = {} dunit_key['id'] = "ks-TestFamily-TestVariant-16-x86_64" dunit_key['version'] = "16" dunit_key['arch'] = "x86_64" dunit_key['family'] = "TestFamily" dunit_key['variant'] = "TestVariant" metadata = { "files" : [{"checksumtype" : "sha256", "relativepath" : "images/fileA.txt", "fileName" : "fileA.txt", "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileA.txt", "item_type" : "tree_file", "savepath" : "%s/testr1/images" % self.data_dir, "checksum" : "22603a94360ee24b7034c74fa13d70dd122aa8c4be2010fc1361e1e6b0b410ab", "filename" : "fileA.txt", "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, "size" : 0 }, { "checksumtype" : "sha256", "relativepath" : "images/fileB.txt", "fileName" : "fileB.txt", "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileB.txt", "item_type" : "tree_file", "savepath" : "%s/testr1/images" % self.data_dir, "checksum" : "8dc89e9883c098443f6616e60a8e489254bf239eeade6e4b4943b7c8c0c345a4", "filename" : "fileB.txt", "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, "size" : 0 }, { "checksumtype" : "sha256", "relativepath" : "images/fileC.iso", "fileName" : "fileC.iso", "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileC.iso", "item_type" : "tree_file", "savepath" : "%s/testr1/images" % self.data_dir, "checksum" : "099f2bafd533e97dcfee778bc24138c40f114323785ac1987a0db66e07086f74", "filename" : "fileC.iso", "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, "size" : 0 } ],} distro_unit = [Unit(TYPE_ID_DISTRO, dunit_key, metadata, '')] distro_unit[0].storage_path = "%s/ks-TestFamily-TestVariant-16-x86_64" % self.pkg_dir existing_units += distro_unit # REPO A (source) repoA = mock.Mock(spec=Repository) repoA.working_dir = self.data_dir repoA.id = "test_distro_unit_copy" # REPO B (target) repoB = mock.Mock(spec=Repository) repoB.working_dir = self.working_dir repoB.id = "repoB" conduit = importer_mocks.get_import_conduit([distro_unit], existing_units=existing_units) config = importer_mocks.get_basic_config() importer = YumImporter() # Test result = importer.import_units(repoA, repoB, conduit, config, distro_unit) # Verify print conduit.associate_unit.call_args_list associated_units = [mock_call[0][0] for mock_call in conduit.associate_unit.call_args_list] self.assertEqual(len(associated_units), len(distro_unit)) for u in associated_units: self.assertTrue(u in distro_unit)
def setup_source_repo(self): # Sync a sample repository to populate and setup up Source Repo source_repo = mock.Mock(spec=Repository) source_repo.id = "repo_a" source_repo.working_dir = os.path.join(self.working_dir, source_repo.id) importer = YumImporter() feed_url = "file://%s/pulp_unittest/" % (self.data_dir) config = importer_mocks.get_basic_config(feed_url=feed_url) sync_conduit = importer_mocks.get_sync_conduit(existing_units=[], pkg_dir=self.pkg_dir) status, summary, details = importer._sync_repo(source_repo, sync_conduit, config) self.assertTrue(status) self.assertEquals(summary["packages"]["num_synced_new_rpms"], 3) # Confirm regular RPM files exist under self.pkg_dir pkgs = self.get_files_in_dir("*.rpm", self.pkg_dir) self.assertEquals(len(pkgs), 3) for p in pkgs: self.assertTrue(os.path.isfile(p)) # Confirm symlinks to RPMs exist under repo.working_dir sym_links = self.get_files_in_dir("*.rpm", source_repo.working_dir) self.assertEquals(len(pkgs), 3) for link in sym_links: self.assertTrue(os.path.islink(link)) # # Now we have some test data in the source repo # # Simulate what import_conduit.get_source_repos would return # metadata = {} source_units = [] storage_path = '%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = {"filename":filename} source_units.append(Unit(TYPE_ID_RPM, unit_key, metadata, storage_path)) storage_path = '%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = {"filename":filename} source_units.append(Unit(TYPE_ID_RPM, unit_key, metadata, storage_path)) storage_path = '%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = {"filename":filename} source_units.append(Unit(TYPE_ID_RPM, unit_key, metadata, storage_path)) # Pass in the simulated source_units to the import_conduit import_conduit = importer_mocks.get_import_conduit(source_units=source_units) return importer, source_repo, source_units, import_conduit, config
def test_import_units__units_empty_list(self): """ Make sure that when an empty list is passed, we import zero units. """ source_units = [Unit(ids.TYPE_ID_ISO, {'name': 'test.iso'}, {}, '/path/test.iso'), Unit(ids.TYPE_ID_ISO, {'name': 'test2.iso'}, {}, '/path/test2.iso'), Unit(ids.TYPE_ID_ISO, {'name': 'test3.iso'}, {}, '/path/test3.iso')] import_conduit = importer_mocks.get_import_conduit(source_units=source_units) # source_repo, dest_repo, and config aren't used by import_units, so we'll just set them to # None for simplicity. Let's pass an empty list as the units we want to import units_to_import = [] imported_units = self.iso_importer.import_units(None, None, import_conduit, None, units=units_to_import) # There should have been zero calls to the import_conduit. None to get_source_units(), and # none to associate units. self.assertEqual(len(import_conduit.get_source_units.call_args_list), 0) self.assertEqual(len(import_conduit.associate_unit.call_args_list), 0) # Make sure that the returned units are correct self.assertEqual(imported_units, units_to_import)
def test_import(self): # Setup existing_units = self.existing_units() # REPO A (source) repoA = mock.Mock(spec=Repository) repoA.working_dir = self.data_dir repoA.id = "test_resolve_deps" # REPO B (target) repoB = mock.Mock(spec=Repository) repoB.working_dir = self.working_dir repoB.id = "repoB" units = [Unit(TYPE_ID_RPM, self.UNIT_KEY_B, {}, '')] conduit = importer_mocks.get_import_conduit(units, existing_units=existing_units) config = importer_mocks.get_basic_config() importer = YumImporter() # Test result = importer.import_units(repoA, repoB, conduit, config, units) # Verify associated_units = [mock_call[0][0] for mock_call in conduit.associate_unit.call_args_list] self.assertEqual(len(associated_units), len(units)) for u in associated_units: self.assertTrue(u in units)
def test_package_category_unit_import(self): # REPO A (source) repoA = mock.Mock(spec=Repository) repoA.working_dir = self.data_dir repoA.id = "test_pkg_cat_unit_copy" # REPO B (target) repoB = mock.Mock(spec=Repository) repoB.working_dir = self.working_dir repoB.id = "repoB" # Create 2 pkg groups grp_a = self.create_dummy_pkg_group_unit(repoA.id, "group_a") # Create 2 pkg categories cat_a = self.create_dummy_pkg_category_unit(repoA.id, "cat_a", ["group_a"]) # Add the grps/cats to the publish_conduit existing_units=[grp_a, cat_a] conduit = importer_mocks.get_import_conduit([cat_a], existing_units=existing_units) config = importer_mocks.get_basic_config() importer = YumImporter() # Test result = importer.import_units(repoA, repoB, conduit, config, [cat_a]) # Verify associated_units = [mock_call[0][0] for mock_call in conduit.associate_unit.call_args_list] for u in associated_units: self.assertTrue(u in [cat_a, grp_a])
def test_import_with_dependencies(self): # Setup existing_units = self.existing_units() # REPO A (source) repoA = mock.Mock(spec=Repository) repoA.working_dir = "/tmp/test_resolve_deps" repoA.id = "test_resolve_deps" # REPO B (target) repoB = mock.Mock(spec=Repository) repoB.working_dir = "/tmp/test_resolve_deps" repoB.id = "repo_b" units = [Unit(TYPE_ID_RPM, self.UNIT_KEY_B, {}, '')] conduit = importer_mocks.get_import_conduit(units, existing_units=existing_units) config = importer_mocks.get_basic_config() config.override_config['recursive'] = True config.override_config['resolve_dependencies'] = True importer = YumImporter() # Test result = importer.import_units(repoA, repoB, conduit, config, units) # Verify associated_units = [mock_call[0][0] for mock_call in conduit.associate_unit.call_args_list] self.assertEqual(len(associated_units), len(existing_units)) for u in associated_units: self.assertTrue(u in existing_units + units)
def setup_source_repo(self): # Sync a sample repository to populate and setup up Source Repo source_repo = mock.Mock(spec=Repository) source_repo.id = "repo_a" source_repo.working_dir = os.path.join(self.working_dir, source_repo.id) importer = YumImporter() feed_url = "file://%s/pulp_unittest/" % (self.data_dir) config = importer_mocks.get_basic_config(feed_url=feed_url) sync_conduit = importer_mocks.get_sync_conduit(existing_units=[], pkg_dir=self.pkg_dir) status, summary, details = importer._sync_repo(source_repo, sync_conduit, config) self.assertTrue(status) self.assertEquals(summary["packages"]["num_synced_new_rpms"], 3) # # Now we have some test data in the source repo # # Simulate what import_conduit.get_source_repos would return # source_units = [] storage_path = '%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-dot-2.0-test', 'version':'0.1.2', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'checksumtype':'sha256', } metadata = { 'filename':filename } source_units.append(Unit(TYPE_ID_RPM, unit_key, metadata, storage_path)) storage_path = '%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-test-package', 'version':'0.3.1', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'checksumtype':'sha256', } metadata = { 'filename':filename } source_units.append(Unit(TYPE_ID_RPM, unit_key, metadata, storage_path)) storage_path = '%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-test-package', 'version':'0.2.1', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'checksumtype':'sha256', } metadata = { 'filename':filename } source_units.append(Unit(TYPE_ID_RPM, unit_key, metadata, storage_path)) # Pass in the simulated source_units to the import_conduit import_conduit = importer_mocks.get_import_conduit(source_units=source_units, existing_units=source_units) return importer, source_repo, source_units, import_conduit, config
def test_package_group_unit_import(self): # REPO A (source) repoA = mock.Mock(spec=Repository) repoA.working_dir = self.data_dir repoA.id = "test_pkg_grp_unit_copy" # REPO B (target) repoB = mock.Mock(spec=Repository) repoB.working_dir = self.working_dir repoB.id = "repoB" # Create 2 pkg groups grp_a = self.create_dummy_pkg_group_unit(repoA.id, "group_a") verify_units =[grp_a] source_units = [] storage_path = '%s/pulp-dot-1.0-test/0.1.1/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-dot-1.0-test', 'version':'0.1.1', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'checksumtype':'sha256', } metadata = { 'filename':filename } u = Unit(TYPE_ID_RPM, unit_key, metadata, storage_path) source_units.append(u) verify_units.append(u) storage_path = '%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-dot-2.0-test', 'version':'0.1.2', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'checksumtype':'sha256', } metadata = { 'filename':filename } u = Unit(TYPE_ID_RPM, unit_key, metadata, storage_path) source_units.append(u) verify_units.append(u) storage_path = '%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-test-package', 'version':'0.3.1', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'checksumtype':'sha256', } metadata = { 'filename':filename } u = Unit(TYPE_ID_RPM, unit_key, metadata, storage_path) source_units.append(u) verify_old_version_skipped = [u] storage_path = '%s/pulp-test-package/0.3.2/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-test-package', 'version':'0.3.2', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'checksumtype':'sha256', } metadata = { 'filename':filename } u = Unit(TYPE_ID_RPM, unit_key, metadata, storage_path) source_units.append(u) verify_units.append(u) storage_path = '%s/pulp-test-optional-package/0.3.2/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm' % (self.pkg_dir) filename = os.path.basename(storage_path) unit_key = { 'name':'pulp-optional-package', 'version':'0.1.1', 'release':'1.fc11', 'epoch':'0', 'arch':'x86_64', 'checksum':'6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'checksumtype':'sha256', } metadata = { 'filename':filename } u = Unit(TYPE_ID_RPM, unit_key, metadata, storage_path) source_units.append(u) verify_units.append(u) grp_a.metadata['mandatory_package_names'] = ["pulp-test-package",] grp_a.metadata['default_package_names'] = ["pulp-dot-2.0-test"] grp_a.metadata['optional_package_names'] = ["pulp-optional-package"] grp_a.metadata['conditional_package_names'] = [('pulp-dot-1.0-test', [])] existing_units = [grp_a] conduit = importer_mocks.get_import_conduit(source_units + [grp_a], existing_units=source_units + existing_units) config = importer_mocks.get_basic_config() importer = YumImporter() # Test result = importer.import_units(repoA, repoB, conduit, config, [grp_a]) # Verify associated_units = [mock_call[0][0] for mock_call in conduit.associate_unit.call_args_list] # verify expected units are in associate units for u in verify_units: self.assertTrue(u in associated_units) # verify that the version compare worked and skipped old versions for u in verify_old_version_skipped: self.assertFalse(u in associated_units)
def test_errata_import_units(self): existing_units = [] unit_key = dict() unit_key['id'] = "RHEA-2010:9999" mdata = { 'description' : "test", 'from_str': '*****@*****.**', 'issued': '2010-03-30 08:07:30', 'pkglist': [{'name': 'RHEL Virtualization (v. 5 for 32-bit x86)', 'packages': [{'arch': 'x86_64', 'epoch': '0', 'filename': 'patb-0.1-2.x86_64.rpm', 'name': 'patb', 'release': '2', 'src': '', 'sum': ('sha', '017c12050a97cf6095892498750c2a39d2bf535e'), 'version': '0.1'}, {'arch': 'x86_64', 'epoch': '0', 'filename': 'emoticons-0.1-2.x86_64.rpm', 'name': 'emoticons', 'release': '2', 'src': '', 'sum': ('sha', '663c89b0d29bfd5479d8736b716d50eed9495dbb'), 'version': '0.1'}], 'short': 'rhel-i386-server-vt-5'}], 'pushcount': 1, 'reboot_suggested': False, 'references': [], 'release': '', 'rights': '', 'status': 'final', 'summary': '', 'title': 'emoticons enhancement fix and enhancement update', 'updated': '2010-03-30 08:07:30', 'version': '1', 'type' : 'enhancement', 'severity' : 'Low', 'solution' : ''} unit_key_2 = dict() unit_key_2['id'] = "RHEA-2008:9999" mdata_2 = { 'description' : "test", 'from_str': '*****@*****.**', 'issued': '2008-03-30 00:00:00', 'pkglist': [{'name': 'RHEL Virtualization (v. 5 for 32-bit x86)', 'packages': [{'arch': 'x86_64', 'epoch': '0', 'filename': 'patb-0.1-2.x86_64.rpm', 'name': 'patb', 'release': '2', 'src': '', 'sum': ('sha', '017c12050a97cf6095892498750c2a39d2bf535e'), 'version': '0.1'}, {'arch': 'x86_64', 'epoch': '0', 'filename': 'emoticons-0.1-2.x86_64.rpm', 'name': 'emoticons', 'release': '2', 'src': '', 'sum': ('sha', '663c89b0d29bfd5479d8736b716d50eed9495dbb'), 'version': '0.1'}], 'short': 'rhel-i386-server-vt-5'}], 'pushcount': 1, 'reboot_suggested': False, 'references': [], 'release': '', 'rights': '', 'status': 'final', 'summary': '', 'title': 'emoticons enhancement fix and enhancement update', 'updated': '2008-03-30 00:00:00', 'version': '1', 'type' : 'enhancement', 'severity' : 'Low', 'solution' : ''} errata_unit = [Unit(TYPE_ID_ERRATA, unit_key, mdata, ''), Unit(TYPE_ID_ERRATA, unit_key_2, mdata_2, '')] existing_units += errata_unit # REPO A (source) repoA = mock.Mock(spec=Repository) repoA.working_dir = self.data_dir repoA.id = "test_errata_unit_copy" # REPO B (target) repoB = mock.Mock(spec=Repository) repoB.working_dir = self.working_dir repoB.id = "repoB" conduit = importer_mocks.get_import_conduit(errata_unit, existing_units=existing_units) config = importer_mocks.get_basic_config(blacklist=['patb']) importer = YumImporter() # Test result = importer.import_units(repoA, repoB, conduit, config, errata_unit) # Verify associated_units = [mock_call[0][0] for mock_call in conduit.associate_unit.call_args_list] self.assertEqual(len(associated_units), len(errata_unit)) for u in associated_units: self.assertTrue(u in errata_unit)