本文整理汇总了Python中pulp.server.db.model.consumer.Consumer.get_collection方法的典型用法代码示例。如果您正苦于以下问题:Python Consumer.get_collection方法的具体用法?Python Consumer.get_collection怎么用?Python Consumer.get_collection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.server.db.model.consumer.Consumer
的用法示例。
在下文中一共展示了Consumer.get_collection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tearDown
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def tearDown(self):
super(BindManagerTests, self).tearDown()
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
mock_plugins.reset()
示例2: test_update_notes
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def test_update_notes(self):
"""
Tests updating notes of a consumer
"""
# Setup
consumer_id = "consumer_1"
name = "Consumer 1"
description = "Test Consumer 1"
notes = {"note1": "value1", "note2": "value2"}
self.manager.register(consumer_id, name, description, notes)
consumers = list(Consumer.get_collection().find())
self.assertEqual(1, len(consumers))
consumer = consumers[0]
self.assertEqual(consumer["notes"], notes)
# Test
updated_notes = {"note1": "new-value1", "note2": "new-value2"}
self.manager.update(consumer_id, delta={"notes": updated_notes})
# Verify
consumers = list(Consumer.get_collection().find())
consumer = consumers[0]
self.assertEqual(consumer["notes"], updated_notes)
示例3: tearDown
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def tearDown(self):
PulpItineraryTests.tearDown(self)
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
mock_plugins.reset()
示例4: unregister
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def unregister(self, id):
"""
Unregisters given consumer.
@param id: identifies the consumer being unregistered
@type id: str
@raises MissingResource: if the given consumer does not exist
@raises OperationFailed: if any part of the unregister process fails;
the exception will contain information on which sections failed
@raises PulpExecutionException: if error during updating database collection
"""
self.get_consumer(id)
# Remove associate bind
manager = factory.consumer_bind_manager()
manager.consumer_deleted(id)
# Remove associated profiles
manager = factory.consumer_profile_manager()
manager.consumer_deleted(id)
# Notify agent
agent_consumer = factory.consumer_agent_manager()
agent_consumer.unregistered(id)
# Database Updates
try:
Consumer.get_collection().remove({'id' : id}, safe=True)
except Exception:
_LOG.exception('Error updating database collection while removing consumer [%s]' % id)
raise PulpExecutionException("database-error"), None, sys.exc_info()[2]
factory.consumer_history_manager().record_event(id, 'consumer_unregistered')
示例5: test_add_notes
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def test_add_notes(self):
"""
Tests adding notes to a consumer.
"""
# Setup
consumer_id = "consumer_1"
name = "Consumer 1"
description = "Test Consumer 1"
self.manager.register(consumer_id, name, description)
consumers = list(Consumer.get_collection().find())
self.assertEqual(1, len(consumers))
# Test
consumer = consumers[0]
self.assertEqual(consumer["notes"], {})
notes = {"note1": "value1", "note2": "value2"}
self.manager.update(consumer_id, delta={"notes": notes})
# Verify
consumers = list(Consumer.get_collection().find())
consumer = consumers[0]
self.assertEqual(consumer["notes"], notes)
示例6: test_add_notes
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def test_add_notes(self):
"""
Tests adding notes to a consumer.
"""
# Setup
consumer_id = 'consumer_1'
name = 'Consumer 1'
description = 'Test Consumer 1'
self.manager.register(consumer_id, name, description)
consumers = list(Consumer.get_collection().find())
self.assertEqual(1, len(consumers))
# Test
consumer = consumers[0]
self.assertEqual(consumer['notes'], {})
notes = {'note1' : 'value1', 'note2' : 'value2'}
self.manager.update(consumer_id, delta={'notes':notes})
# Verify
consumers = list(Consumer.get_collection().find())
consumer = consumers[0]
self.assertEqual(consumer['notes'], notes)
示例7: test_update_notes
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def test_update_notes(self):
"""
Tests updating notes of a consumer
"""
# Setup
consumer_id = 'consumer_1'
name = 'Consumer 1'
description = 'Test Consumer 1'
notes = {'note1' : 'value1', 'note2' : 'value2'}
self.manager.register(consumer_id, name, description, notes)
consumers = list(Consumer.get_collection().find())
self.assertEqual(1, len(consumers))
consumer = consumers[0]
self.assertEqual(consumer['notes'], notes)
# Test
updated_notes = {'note1' : 'new-value1', 'note2' : 'new-value2'}
self.manager.update(consumer_id, delta={'notes':updated_notes})
# Verify
consumers = list(Consumer.get_collection().find())
consumer = consumers[0]
self.assertEqual(consumer['notes'], updated_notes)
示例8: tearDown
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def tearDown(self):
base.PulpWebserviceTests.tearDown(self)
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
mock_plugins.reset()
示例9: setUp
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def setUp(self):
base.PulpWebserviceTests.setUp(self)
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
plugin_api._create_manager()
mock_plugins.install()
示例10: tearDown
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def tearDown(self):
PulpRPMTests.tearDown(self)
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoContentUnit.get_collection().remove()
RepoDistributor.get_collection().remove()
database.clean()
plugins.finalize()
示例11: tearDown
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def tearDown(self):
super(BindManagerTests, self).tearDown()
Consumer.get_collection().remove()
model.Repository.objects.delete()
model.Distributor.objects.delete()
Bind.get_collection().remove()
ConsumerHistoryEvent.get_collection().remove()
mock_plugins.reset()
示例12: setUp
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def setUp(self):
super(BindManagerTests, self).setUp()
Consumer.get_collection().remove()
model.Distributor.objects.delete()
Bind.get_collection().remove()
ConsumerHistoryEvent.get_collection().remove()
plugin_api._create_manager()
mock_plugins.install()
示例13: tearDown
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def tearDown(self):
super(self.__class__, self).tearDown()
Consumer.get_collection().remove()
ConsumerGroup.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
mock_plugins.reset()
示例14: setUp
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def setUp(self):
super(BindManagerTests, self).setUp()
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
plugin_api._create_manager()
mock_plugins.install()
示例15: setUp
# 需要导入模块: from pulp.server.db.model.consumer import Consumer [as 别名]
# 或者: from pulp.server.db.model.consumer.Consumer import get_collection [as 别名]
def setUp(self):
PulpItineraryTests.setUp(self)
Consumer.get_collection().remove()
Repo.get_collection().remove()
RepoDistributor.get_collection().remove()
Bind.get_collection().remove()
plugin_api._create_manager()
mock_plugins.install()
mock_agent.install()