def test_unit_applicable_false(self): rpm_unit_key = self.create_profile_entry("bla-bla", 0, "0.1", "2", "x86_64", "Test Vendor") rpm_unit = Unit(TYPE_ID_RPM, rpm_unit_key, {}, None) existing_units = [rpm_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_rpms = [rpm_unit.unit_key] prof = RPMPkgProfiler() report_list = prof.units_applicable( self.test_consumer_i386, ["test_repo_id"], TYPE_ID_RPM, example_rpms, None, conduit ) self.assertTrue(report_list == [])
def test_rpm_applicable_to_consumer(self): rpm = {} prof = RPMPkgProfiler() applicable, old_rpm = prof.rpm_applicable_to_consumer(Consumer("test", {}), rpm) self.assertEqual(applicable, False) self.assertEqual(old_rpm, {}) # Test with newer RPM # The consumer has already been configured with a profile containing 'emoticons' rpm = self.create_profile_entry("emoticons", 0, "0.1", "2", "x86_64", "Test Vendor") applicable, old_rpm = prof.rpm_applicable_to_consumer(self.test_consumer, rpm) self.assertTrue(applicable) self.assertTrue(old_rpm) self.assertTrue(old_rpm.has_key("emoticons x86_64")) self.assertEqual("emoticons", old_rpm["emoticons x86_64"]["installed"]["name"]) self.assertEqual("0.0.1", old_rpm["emoticons x86_64"]["installed"]["version"])
def test_metadata(self): data = RPMPkgProfiler.metadata() self.assertTrue(data.has_key("id")) self.assertEquals(data["id"], TYPE_ID_PROFILER_RPM_PKG) self.assertTrue(data.has_key("display_name")) self.assertTrue(data.has_key("types")) self.assertTrue(TYPE_ID_RPM in data["types"])