本文整理汇总了Python中trove.guestagent.models.AgentHeartBeat.find_all_by_version方法的典型用法代码示例。如果您正苦于以下问题:Python AgentHeartBeat.find_all_by_version方法的具体用法?Python AgentHeartBeat.find_all_by_version怎么用?Python AgentHeartBeat.find_all_by_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类trove.guestagent.models.AgentHeartBeat
的用法示例。
在下文中一共展示了AgentHeartBeat.find_all_by_version方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_all_by_version_none
# 需要导入模块: from trove.guestagent.models import AgentHeartBeat [as 别名]
# 或者: from trove.guestagent.models.AgentHeartBeat import find_all_by_version [as 别名]
def test_find_all_by_version_none(self):
"""
Test to retrieve all guest agents with a None version
"""
heartbeats = None
exception_raised = False
try:
heartbeats = AgentHeartBeat.find_all_by_version(None)
except exception.ModelNotFoundError:
exception_raised = True
self.assertIsNone(heartbeats)
self.assertTrue(exception_raised)
示例2: test_find_all_by_version_not_found
# 需要导入模块: from trove.guestagent.models import AgentHeartBeat [as 别名]
# 或者: from trove.guestagent.models.AgentHeartBeat import find_all_by_version [as 别名]
def test_find_all_by_version_not_found(self):
"""
Test to retrieve all guest agents with a non-existing version
"""
version = str(uuid.uuid4())
exception_raised = False
heartbeats = None
try:
heartbeats = AgentHeartBeat.find_all_by_version(version)
except exception.ModelNotFoundError:
exception_raised = True
self.assertIsNone(heartbeats)
self.assertTrue(exception_raised)
示例3: test_find_all_by_version
# 需要导入模块: from trove.guestagent.models import AgentHeartBeat [as 别名]
# 或者: from trove.guestagent.models.AgentHeartBeat import find_all_by_version [as 别名]
def test_find_all_by_version(self):
"""
Test to retrieve all guest agents with a particular version
"""
# create some unique records with the same version
version = str(uuid.uuid4())
for x in xrange(5):
instance_id = str(uuid.uuid4())
heartbeat = AgentHeartBeat.create(
instance_id=instance_id,
guest_agent_version=version,
deleted=0)
self.assertIsNotNone(heartbeat)
# get all guests by version
heartbeats = AgentHeartBeat.find_all_by_version(version)
self.assertIsNotNone(heartbeats)
self.assertEqual(5, heartbeats.count())