def test_translate_bad_unit_id(self): bad_unit = Unit("BAD_UNIT_ID", {"id":"bad_id"}, {}, None) prof = RPMErrataProfiler() caught_exception = False try: applicable_rpms = prof.translate(bad_unit, self.test_consumer, conduit) except: caught_exception = True self.assertTrue(caught_exception)
def test_translate(self): # Setup test data errata_obj = self.get_test_errata_object() errata_unit = Unit(TYPE_ID_ERRATA, {"id":errata_obj["id"]}, errata_obj, None) existing_units = [errata_unit] test_repo = profiler_mocks.get_repo("test_repo_id") conduit = profiler_mocks.get_profiler_conduit(existing_units=existing_units, repo_bindings=[test_repo]) example_errata = {"unit_key":errata_unit.unit_key, "type_id":TYPE_ID_ERRATA} # Test prof = RPMErrataProfiler() applicable_rpms, upgrade_details = prof.translate(example_errata, self.test_consumer, conduit) self.assertEqual(len(applicable_rpms), 2) self.assertEqual(len(upgrade_details), 2)