def setUp(self): migrate.initUp2dateConfig = lambda: {} self.engine = migrate.MigrationEngine() self.engine.cp = stubs.StubUEP() # These tests print a lot to stdout and stderr # so quiet them. sys.stdout = stubs.MockStdout() sys.stderr = stubs.MockStderr() self.double_mapped_channels = ( "rhel-i386-client-dts-5-beta", "rhel-i386-client-dts-5-beta-debuginfo", "rhel-i386-server-dts-5-beta", "rhel-i386-server-dts-5-beta-debuginfo", "rhel-x86_64-client-dts-5-beta", "rhel-x86_64-client-dts-5-beta-debuginfo", "rhel-x86_64-server-dts-5-beta", "rhel-x86_64-server-dts-5-beta-debuginfo", ) self.single_mapped_channels = ( "rhel-i386-client-dts-5", "rhel-i386-client-dts-5-debuginfo", "rhel-x86_64-client-dts-5", "rhel-x86_64-client-dts-5-debuginfo", "rhel-i386-server-dts-5", "rhel-i386-server-dts-5-debuginfo", "rhel-x86_64-server-dts-5", "rhel-x86_64-server-dts-5-debuginfo", )
def setUp(self): stub_prod = StubProduct("fauxprod", provided_tags="TAG1,TAG2") stub_prod2 = StubProduct("fauxprovidedprod", provided_tags="TAG4") stub_prod_cert = StubProductCertificate(stub_prod, provided_products=[stub_prod2]) stub_prod2 = StubProduct("fauxprod2", provided_tags="TAG5,TAG6") stub_prod2_cert = StubProductCertificate(stub_prod2) stub_prod_dir = StubProductDirectory([stub_prod_cert, stub_prod2_cert]) stub_content = [ StubContent("c1", required_tags="", gpg=None), # no required tags StubContent("c2", required_tags="TAG1", gpg=""), StubContent("c3", required_tags="TAG1,TAG2,TAG3"), # should get skipped StubContent("c4", required_tags="TAG1,TAG2,TAG4,TAG5,TAG6", gpg="/gpg.key", url="/$some/$path"), StubContent("c5", content_type="file", required_tags="", gpg=None), StubContent("c6", content_type="file", required_tags="", gpg=None), ] self.stub_ent_cert = StubEntitlementCertificate(stub_prod, content=stub_content) stub_ent_dir = StubCertificateDirectory([self.stub_ent_cert]) repolib.ConsumerIdentity = stubs.StubConsumerIdentity stub_uep = stubs.StubUEP() self.update_action = UpdateAction(prod_dir=stub_prod_dir, ent_dir=stub_ent_dir, uep=stub_uep)
def setUp(self): super(TestMigration, self).setUp() migrate.initUp2dateConfig = lambda: {} patch('subscription_manager.migrate.migrate.ProductDatabase').start() self.engine = migrate.MigrationEngine(self.create_options()) self.engine.cp = stubs.StubUEP() # These tests print a lot to stdout and stderr # so quiet them. sys.stderr = stubs.MockStderr() self.double_mapped_channels = ( "rhel-i386-client-dts-5-beta", "rhel-i386-client-dts-5-beta-debuginfo", "rhel-i386-server-dts-5-beta", "rhel-i386-server-dts-5-beta-debuginfo", "rhel-x86_64-client-dts-5-beta", "rhel-x86_64-client-dts-5-beta-debuginfo", "rhel-x86_64-server-dts-5-beta", "rhel-x86_64-server-dts-5-beta-debuginfo", ) self.single_mapped_channels = ( "rhel-i386-client-dts-5", "rhel-i386-client-dts-5-debuginfo", "rhel-x86_64-client-dts-5", "rhel-x86_64-client-dts-5-debuginfo", "rhel-i386-server-dts-5", "rhel-i386-server-dts-5-debuginfo", "rhel-x86_64-server-dts-5", "rhel-x86_64-server-dts-5-debuginfo", )
def setUp(self): self.stub_uep = stubs.StubUEP() self.fl = factlib.FactLib(lock=MockActionLock(), uep=self.stub_uep) self.expected_facts = {'fact1': 'F1', 'fact2': 'F2'} def init_facts(): return stubs.StubFacts(self.expected_facts) self.fl._get_facts = init_facts
def setUp(self): super(TestMigration, self).setUp() migrate.initUp2dateConfig = lambda: {} self.system_id = dedent(""" <params> <param> <value> <struct> <member> <name>system_id</name> <value> <string>ID-123</string> </value> </member> </struct> </value> </param> </params> """) patch('subscription_manager.migrate.migrate.ProductDatabase').start() with temp_file(self.system_id) as temp_id_file: with patch("subscription_manager.migrate.migrate.initUp2dateConfig") as init_conf: init_conf.return_value = {"systemIdPath": temp_id_file} self.engine = migrate.MigrationEngine(self.create_options()) self.engine.cp = stubs.StubUEP() self.system_id_file = temp_id_file # These tests print a lot to stdout and stderr # so quiet them. sys.stderr = stubs.MockStderr() self.double_mapped_channels = ( "rhel-i386-client-dts-5-beta", "rhel-i386-client-dts-5-beta-debuginfo", "rhel-i386-server-dts-5-beta", "rhel-i386-server-dts-5-beta-debuginfo", "rhel-x86_64-client-dts-5-beta", "rhel-x86_64-client-dts-5-beta-debuginfo", "rhel-x86_64-server-dts-5-beta", "rhel-x86_64-server-dts-5-beta-debuginfo", ) self.single_mapped_channels = ( "rhel-i386-client-dts-5", "rhel-i386-client-dts-5-debuginfo", "rhel-x86_64-client-dts-5", "rhel-x86_64-client-dts-5-debuginfo", "rhel-i386-server-dts-5", "rhel-i386-server-dts-5-debuginfo", "rhel-x86_64-server-dts-5", "rhel-x86_64-server-dts-5-debuginfo", )
def test_factlib_updates_when_identity_exists(self): invalid_consumer = self._inject_mock_valid_consumer() self.facts_passed_to_server = None self.consumer_uuid_passed_to_server = None def track_facts_update(consumer_uuid, facts): self.facts_passed_to_server = facts self.consumer_uuid_passed_to_server = consumer_uuid stub_uep = stubs.StubUEP() stub_uep.updateConsumer = track_facts_update self.set_consumer_auth_cp(stub_uep) update_report = self.fl.update() count = update_report.updates() self.assertEquals(len(self.expected_facts), count) self.assertEquals(self.expected_facts, self.facts_passed_to_server) self.assertEquals(invalid_consumer.uuid, self.consumer_uuid_passed_to_server)
def setUp(self): self.stub_uep = stubs.StubUEP() self.expected_facts = {'fact1': 'F1', 'fact2': 'F2'} self.fl = factlib.FactLib(lock=stubs.MockActionLock(), uep=self.stub_uep, facts=stubs.StubFacts(self.expected_facts))
def _get_idcertlib(self): self.stub_uep = stubs.StubUEP() self.stub_uep.getConsumer = getConsumerData self.stub_uep.getSerialNumber = getSerialNumber return certlib.IdentityCertLib(lock=stubs.MockActionLock(), uep=self.stub_uep)