def test_main_window(self): provide(PROD_DIR, stubs.StubProductDirectory([])) provide(PRODUCT_DATE_RANGE_CALCULATOR, mock.Mock()) managergui.MainWindow(backend=stubs.StubBackend(), ent_dir=stubs.StubCertificateDirectory([]), prod_dir=stubs.StubProductDirectory([]))
def setUp(self): stub_content = stubs.StubContent("c1", required_tags='rhel-6', gpg=None, enabled="1") # this content should be ignored since it's not enabled stub_content_2 = stubs.StubContent("c2", required_tags='rhel-6', gpg=None, enabled="0") # this should be ignored because of required_tag isn't what we # are looking for stub_content_3 = stubs.StubContent("c3", required_tags="NotAwesomeOS", gpg=None, enabled="1") # this should be ignored because of required_tag isn't what we # are looking for, and it is not enabled stub_content_4 = stubs.StubContent("c4", required_tags="NotAwesomeOS", gpg=None, enabled="0") stub_contents = [ stub_content, stub_content_2, stub_content_3, stub_content_4 ] stub_product = stubs.StubProduct("rhel-6") stub_entitlement_certs = [ stubs.StubEntitlementCertificate(stub_product, content=stub_contents) ] stub_entitlement_dir = stubs.StubEntitlementDirectory( stub_entitlement_certs) stub_product_dir = stubs.StubCertificateDirectory([ stubs.StubProductCertificate( stubs.StubProduct("rhel-6", provided_tags="rhel-6-stub"), ) ]) def get_versions(dummy): return versions stub_content_connection = stubs.StubContentConnection() stub_content_connection.get_versions = get_versions self.rb = release.ReleaseBackend( ent_dir=stub_entitlement_dir, prod_dir=stub_product_dir, content_connection=stub_content_connection)
def test_main_window(self): managergui.ConsumerIdentity = stubs.StubConsumerIdentity installedtab.ConsumerIdentity = stubs.StubConsumerIdentity managergui.Backend = stubs.StubBackend managergui.Consumer = StubConsumer managergui.Facts = stubs.StubFacts() managergui.MainWindow(backend=stubs.StubBackend(), consumer=StubConsumer(), facts=stubs.StubFacts(), ent_dir=stubs.StubCertificateDirectory([]), prod_dir=stubs.StubProductDirectory([]))
def _getPrefDialog(self): stub_backend = stubs.StubBackend() stub_backend.cp_provider.consumer_auth_cp.setConsumer(CONSUMER_DATA) stub_backend.product_dir = stubs.StubCertificateDirectory([stubs.StubProductCertificate(stubs.StubProduct("rhel-6"))]) stub_backend.entitlement_dir = stubs.StubEntitlementDirectory([stubs.StubEntitlementCertificate(stubs.StubProduct("rhel-6"))]) self.preferences_dialog = preferences.PreferencesDialog(backend=stub_backend, parent=None) self.preferences_dialog.release_backend.facts = stubs.StubFacts() self.preferences_dialog.release_backend.get_releases = get_releases self.preferences_dialog.async_updater = stubs.StubAsyncUpdater(self.preferences_dialog)
def test_autobind_load_provided_products(self): self.stub_product = stubs.StubProduct("some_random_product") self.stub_pool = modelhelpers.create_pool( product_id=self.stub_product.getHash(), product_name=self.stub_product.getName(), provided_products=['rhel-6']) self.stub_backend.uep.stub_pool = self.stub_pool self.stub_installed_product = stubs.StubProduct("rhel-6") self.stub_backend.product_dir = stubs.StubCertificateDirectory( [stubs.StubProductCertificate(self.stub_installed_product)]) autobind_controller = self._get_autobind_controller() autobind_controller.load() self.assertTrue('Pro' in autobind_controller.suitable_slas)
def setUp(self): self.stub_backend = stubs.StubBackend() self.stub_consumer = stubs.StubConsumer() self.stub_facts = stubs.StubFacts() self.stub_backend.uep.getConsumer = self._getConsumerData self.stub_product = stubs.StubProduct("rhel-6") self.stub_pool = modelhelpers.create_pool( product_id=self.stub_product.getHash(), product_name=self.stub_product.getName()) self.stub_backend.uep.stub_pool = self.stub_pool self.stub_backend.product_dir = stubs.StubCertificateDirectory( [stubs.StubProductCertificate(self.stub_product)]) self.stub_backend.entitlement_dir = stubs.StubEntitlementDirectory([]) self.stub_backend.uep.dryRunBind = self._dryRunBind
def _getPrefDialog(self): stub_backend = stubs.StubBackend() stub_backend.uep.getConsumer = getConsumerData if self._getConsumerData: stub_backend.uep.getConsumer = self._getConsumerData self.consumer = StubConsumer() if self._getConsumer: self.consumer = self._getConsumer() stub_backend.product_dir = stubs.StubCertificateDirectory( [stubs.StubProductCertificate(stubs.StubProduct("rhel-6"))]) stub_backend.entitlement_dir = stubs.StubEntitlementDirectory( [stubs.StubEntitlementCertificate(stubs.StubProduct("rhel-6"))]) self.preferences_dialog = preferences.PreferencesDialog( backend=stub_backend, consumer=self.consumer, parent=None) self.preferences_dialog.release_backend.facts = stubs.StubFacts() self.preferences_dialog.release_backend.get_releases = get_releases
def test_autobind_no_installed_product(self): self.stub_backend.product_dir = stubs.StubCertificateDirectory([]) autobind_controller = self._get_autobind_controller() self.assertRaises(autobind.NoProductsException, autobind_controller.load)