本文整理汇总了Python中ralph.discovery.models.DeviceModelGroup.slots方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceModelGroup.slots方法的具体用法?Python DeviceModelGroup.slots怎么用?Python DeviceModelGroup.slots使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ralph.discovery.models.DeviceModelGroup
的用法示例。
在下文中一共展示了DeviceModelGroup.slots方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_blade_server
# 需要导入模块: from ralph.discovery.models import DeviceModelGroup [as 别名]
# 或者: from ralph.discovery.models.DeviceModelGroup import slots [as 别名]
def test_blade_server(self):
encl = Device.create(sn='devicex', model_type=DeviceType.blade_system,
model_name='device encl')
dev = Device.create(sn='device', model_type=DeviceType.blade_server,
model_name='device', parent=encl)
encl_dmg = DeviceModelGroup(name='DeviceModelGroup encl')
encl_dmg.slots = 4
encl_dmg.price = 65535
encl_dmg.save()
encl.model.group = encl_dmg
encl.model.save()
dmg = DeviceModelGroup(name='DeviceModelGroup')
dmg.price = 1337
dmg.slots = 1
dmg.save()
dev.model.group = dmg
dev.model.save()
pricing.device_update_cached(encl)
pricing.device_update_cached(dev)
dev = Device.objects.get(id=dev.id)
encl = Device.objects.get(id=encl.id)
self.assertEquals(dev.cached_price, 17720.75)
self.assertEquals(encl.cached_price, 49151.25)
self.assertEquals(dev.cached_price + encl.cached_price, 65535 + 1337)