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 _create_cert(product_id, name, version, provided_tags): cert = stubs.StubProductCertificate(product=stubs.StubProduct( product_id=product_id, name=name, version=version, provided_tags=provided_tags), start_date=START_DATE, end_date=END_DATE) cert.delete = mock.Mock() cert.write = mock.Mock() return cert