本文整理匯總了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)