本文整理汇总了Python中subscription_manager.injection.provide函数的典型用法代码示例。如果您正苦于以下问题:Python provide函数的具体用法?Python provide怎么用?Python provide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了provide函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
super(TestFactlib, self).setUp()
#self.stub_uep = stubs.StubUEP()
self.expected_facts = {'fact1': 'F1', 'fact2': 'F2'}
inj.provide(inj.FACTS, stubs.StubFacts(self.expected_facts))
self.fl = factlib.FactsActionInvoker()
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:7,代码来源:test_factlib.py
示例2: setUp
def setUp(self):
super(TestFactlib, self).setUp()
# As set in fixture.py:
self.expected_facts = {"mock.facts": "true"}
inj.provide(inj.FACTS, stubs.StubFacts(self.expected_facts))
self.fl = factlib.FactsActionInvoker()
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:test_factlib.py
示例3: test_unsubscribe_registered
def test_unsubscribe_registered(self):
connection.UEPConnection = StubUEP
prod = StubProduct('stub_product')
ent1 = StubEntitlementCertificate(prod)
ent2 = StubEntitlementCertificate(prod)
ent3 = StubEntitlementCertificate(prod)
inj.provide(inj.ENT_DIR,
StubEntitlementDirectory([ent1, ent2, ent3]))
inj.provide(inj.PROD_DIR,
StubProductDirectory([]))
cmd = managercli.UnSubscribeCommand()
managercli.ConsumerIdentity = StubConsumerIdentity
StubConsumerIdentity.existsAndValid = classmethod(lambda cls: True)
StubConsumerIdentity.exists = classmethod(lambda cls: True)
managercli.CertLib = StubCertLib
cmd.main(['unsubscribe', '--all'])
self.assertEquals(cmd.cp.called_unbind_uuid,
StubConsumerIdentity.CONSUMER_ID)
cmd.main(['unsubscribe', '--serial=%s' % ent1.serial])
self.assertEquals(cmd.cp.called_unbind_serial, ['%s' % ent1.serial])
code = cmd.main(['unsubscribe', '--serial=%s' % ent2.serial, '--serial=%s' % ent3.serial])
self.assertEquals(cmd.cp.called_unbind_serial, ['%s' % ent2.serial, '%s' % ent3.serial])
self.assertEquals(code, 0)
connection.UEPConnection.unbindBySerial = mock.Mock(
side_effect=connection.RestlibException("Entitlement Certificate with serial number 2300922701043065601 could not be found."))
code = cmd.main(['unsubscribe', '--serial=%s' % '2300922701043065601'])
self.assertEquals(code, 1)
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:34,代码来源:test_unsubscribe.py
示例4: setUp
def setUp(self):
super(TestReleaseIsCorrectRhel, self).setUp()
inj.provide(inj.ENT_DIR, self.ent_dir)
inj.provide(inj.PROD_DIR, self.prod_dir)
self.cdn_rv_provider = release.CdnReleaseVersionProvider()
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:test_release.py
示例5: setUp
def setUp(self):
SubManFixture.setUp(self)
self.status = json.loads(INST_PROD_STATUS)['installedProducts']
self.prod_status_cache = NonCallableMock()
self.prod_status_cache.load_status = Mock(return_value=self.status)
inj.provide(inj.PROD_STATUS_CACHE, self.prod_status_cache)
self.calculator = ValidProductDateRangeCalculator(None)
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:7,代码来源:test_validity.py
示例6: test_get_brand_branded_unknown_brand_type
def test_get_brand_branded_unknown_brand_type(self):
stub_installed_product = StubProduct(id=123, name="Stub Product Name")
# note, no 'brand_type' attribute
other_stub_installed_product = StubProduct(id=321, name="A Non Branded Product")
mock_product_dir = mock.NonCallableMock()
mock_product_dir.get_installed_products.return_value = [
stub_installed_product.id,
other_stub_installed_product.id,
]
inj.provide(inj.PROD_DIR, mock_product_dir)
stub_product = StubProduct(
id=123, brand_type="middleware", name="Stub Product Name", brand_name="Awesome Middleware"
)
mock_ent_cert = mock.Mock()
mock_ent_cert.products = [stub_product]
ent_certs = [mock_ent_cert]
# NOTE: this looks like a branded product, except the brand type is one
# the RHELBrandPicker doesn't know
brand_picker = rhelentbranding.RHELBrandPicker(ent_certs)
brand = brand_picker.get_brand()
self.assertTrue(brand is None)
开发者ID:ggainey,项目名称:subscription-manager,代码行数:26,代码来源:test_entbranding.py
示例7: test
def test(self):
stub_product = DefaultStubProduct()
mock_prod_dir = mock.NonCallableMock(name="MockProductDir")
mock_prod_dir.get_installed_products.return_value = [stub_product.id]
inj.provide(inj.PROD_DIR, mock_prod_dir)
mock_ent_cert = mock.Mock(name="MockEntCert")
mock_ent_cert.products = [stub_product]
brand_installer = self.brand_installer_class([mock_ent_cert])
brand_installer.install()
self.assertTrue(self.mock_install.called)
call_args = self.mock_install.call_args
brand_arg = call_args[0][0]
self.assertTrue(isinstance(brand_arg, entbranding.ProductBrand))
self.assertTrue(isinstance(brand_arg, rhelentbranding.RHELProductBrand))
self.assertEquals("Awesome OS super", brand_arg.name)
# verify the install on all the installers got called
count = 0
for bi in brand_installer.brand_installers:
if isinstance(bi, mock.Mock):
self.assertTrue(bi.install.called)
count = count + 1
self.assertEquals(2, count)
开发者ID:ggainey,项目名称:subscription-manager,代码行数:28,代码来源:test_entbranding.py
示例8: setUp
def setUp(self):
super(TestReleaseIsCorrectRhel, self).setUp()
inj.provide(inj.ENT_DIR, self.ent_dir)
inj.provide(inj.PROD_DIR, self.prod_dir)
self.rb = release.ReleaseBackend()
开发者ID:aweiteka,项目名称:subscription-manager,代码行数:7,代码来源:test_release.py
示例9: _get_rb
def _get_rb(self):
inj.provide(inj.ENT_DIR, self.ent_dir)
inj.provide(inj.PROD_DIR, self.prod_dir)
rb = release.ReleaseBackend()
return rb
开发者ID:aweiteka,项目名称:subscription-manager,代码行数:7,代码来源:test_release.py
示例10: test_scan_for_expired_or_future_products
def test_scan_for_expired_or_future_products(self):
prod_dir = StubProductDirectory(pids=["a", "b", "c", "d", "e"])
ent_dir = StubEntitlementDirectory([
StubEntitlementCertificate(StubProduct("a")),
StubEntitlementCertificate(StubProduct("b")),
StubEntitlementCertificate(StubProduct("c")),
StubEntitlementCertificate(StubProduct("d"),
start_date=datetime.now() - timedelta(days=365),
end_date=datetime.now() - timedelta(days=2)),
StubEntitlementCertificate(StubProduct("e"),
start_date=datetime.now() + timedelta(days=365),
end_date=datetime.now() + timedelta(days=730)),
])
inj.provide(inj.PROD_DIR, prod_dir)
inj.provide(inj.ENT_DIR, ent_dir)
sorter = StubCertSorter()
sorter.valid_products = {"a": StubProduct("a")}
sorter.partially_valid_products = {"b": StubProduct("b")}
sorter._scan_entitlement_certs()
self.assertEqual(["d"], list(sorter.expired_products.keys()))
self.assertEqual(["e"], list(sorter.future_products.keys()))
self.assertEqual(3, len(sorter.valid_entitlement_certs))
开发者ID:Januson,项目名称:subscription-manager,代码行数:27,代码来源:test_cert_sorter.py
示例11: test_missing_installed_product
def test_missing_installed_product(self, mock_update):
# Add a new installed product server doesn't know about:
prod_dir = StubProductDirectory(pids=[INST_PID_1, INST_PID_2,
INST_PID_3, "product4"])
inj.provide(inj.PROD_DIR, prod_dir)
sorter = CertSorter()
self.assertTrue('product4' in sorter.unentitled_products)
开发者ID:Januson,项目名称:subscription-manager,代码行数:7,代码来源:test_cert_sorter.py
示例12: test_no_ent_certs_installed_products
def test_no_ent_certs_installed_products(self):
prod_dir = stubs.StubProductDirectory(pids=[1, 2, 3, 4, 5])
inj.provide(inj.PROD_DIR, prod_dir)
brand_installer = self.brand_installer_class([])
brand_installer.install()
self.assertFalse(self.mock_install.called)
开发者ID:ggainey,项目名称:subscription-manager,代码行数:7,代码来源:test_entbranding.py
示例13: test_unregistered
def test_unregistered(self):
id_mock = NonCallableMock()
id_mock.is_valid.return_value = False
inj.provide(inj.IDENTITY, id_mock)
self.calculator = ValidProductDateRangeCalculator(None)
for pid in (INST_PID_1, INST_PID_2, INST_PID_3):
self.assertTrue(self.calculator.calculate(pid) is None)
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:7,代码来源:test_validity.py
示例14: test_unsubscribe_registered
def test_unsubscribe_registered(self):
prod = StubProduct('stub_product')
ent1 = StubEntitlementCertificate(prod)
ent2 = StubEntitlementCertificate(prod)
ent3 = StubEntitlementCertificate(prod)
inj.provide(inj.ENT_DIR, StubEntitlementDirectory([ent1, ent2, ent3]))
inj.provide(inj.PROD_DIR, StubProductDirectory([]))
cmd = managercli.UnSubscribeCommand()
mock_identity = self._inject_mock_valid_consumer()
managercli.EntCertActionInvoker = StubEntActionInvoker
cmd.main(['unsubscribe', '--all'])
self.assertEqual(cmd.cp.called_unbind_uuid, mock_identity.uuid)
cmd.cp.reset()
cmd.main(['unsubscribe', '--serial=%s' % ent1.serial])
self.assertEqual(cmd.cp.called_unbind_serial, ['%s' % ent1.serial])
cmd.cp.reset()
code = cmd.main(['unsubscribe', '--serial=%s' % ent2.serial, '--serial=%s' % ent3.serial])
self.assertEqual(cmd.cp.called_unbind_serial, ['%s' % ent2.serial, '%s' % ent3.serial])
self.assertEqual(code, 0)
expected_exception = connection.RestlibException("Entitlement Certificate with serial number "
"2300922701043065601 could not be found.")
self.stub_cp_provider.get_consumer_auth_cp().unbindBySerial = mock.Mock(side_effect=expected_exception)
code = cmd.main(['unsubscribe', '--serial=%s' % '2300922701043065601'])
开发者ID:Januson,项目名称:subscription-manager,代码行数:29,代码来源:test_unsubscribe.py
示例15: setUp
def setUp(self):
super(TestManagerGuiMainWindow, self).setUp()
id_mock = mock.Mock()
id_mock.name = "John Q Consumer"
id_mock.uuid = "211211381984"
id_mock.exists_and_valid = mock.Mock(return_value=True)
provide(IDENTITY, id_mock)
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:7,代码来源:test_managergui.py
示例16: test_main_window
def test_main_window(self):
provide(PROD_DIR, stubs.StubProductDirectory([]))
provide(PRODUCT_DATE_RANGE_CALCULATOR, mock.Mock())
managergui.MainWindow(backend=stubs.StubBackend(), facts=stubs.StubFacts(),
ent_dir=stubs.StubCertificateDirectory([]),
prod_dir=stubs.StubProductDirectory([]))
开发者ID:jkonecny12,项目名称:subscription-manager,代码行数:8,代码来源:test_managergui.py
示例17: test_idcertlib_noops_when_serialnum_is_same
def test_idcertlib_noops_when_serialnum_is_same(self, mock_persist):
id_update_action = identitycertlib.IdentityUpdateAction()
#certlib.ConsumerIdentity = stubs.StubConsumerIdentity
#certlib.ConsumerIdentity.getSerialNumber = getSerialNumber
inj.provide(inj.IDENTITY, InvalidIdentity())
id_update_action.perform()
self.assertFalse(mock_persist.called)
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:9,代码来源:test_identitycertlib.py
示例18: testShowPreferencesDialogNoConsumer
def testShowPreferencesDialogNoConsumer(self):
id_mock = mock.Mock()
id_mock.name = "John Q Consumer"
id_mock.uuid = None
id_mock.exists_and_valid = mock.Mock(return_value=True)
provide(IDENTITY, id_mock)
self._getPrefDialog()
self.preferences_dialog.show()
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:9,代码来源:test_preferences.py
示例19: test_entitlement_for_not_installed_product_shows_nothing
def test_entitlement_for_not_installed_product_shows_nothing(self):
product_directory = StubProductDirectory([])
provide(PROD_DIR, product_directory)
product_status = get_installed_product_status(product_directory,
None, StubUEP())
# no product certs installed...
self.assertEquals(0, len(product_status))
开发者ID:tkolhar,项目名称:subscription-manager,代码行数:9,代码来源:test_managerlib.py
示例20: setUp
def setUp(self):
super(TestPreferencesDialog, self).setUp()
# FIXME: this is c&p and could be in a fixture sub class
# that does the same things StubConsumer does now
self.id_mock = mock.Mock()
self.id_mock.name = "John Q Consumer"
self.id_mock.uuid = "not_actually_a_uuid"
self.id_mock.exists_and_valid = mock.Mock(return_value=True)
provide(IDENTITY, self.id_mock)
开发者ID:MichaelMraka,项目名称:subscription-manager,代码行数:9,代码来源:test_preferences.py
注:本文中的subscription_manager.injection.provide函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论