本文整理匯總了Python中ralph.discovery.models.Processor.save方法的典型用法代碼示例。如果您正苦於以下問題:Python Processor.save方法的具體用法?Python Processor.save怎麽用?Python Processor.save使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ralph.discovery.models.Processor
的用法示例。
在下文中一共展示了Processor.save方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_processors
# 需要導入模塊: from ralph.discovery.models import Processor [as 別名]
# 或者: from ralph.discovery.models.Processor import save [as 別名]
def test_processors(self):
model = ComponentModel(type=ComponentType.processor, name="CPU Xeon 2533MHz, 4-core")
model.save()
for i in xrange(4):
p = Processor(label="ziew", model=model, device=self.device, index=i)
p.save()
data = get_device_data(Device.objects.get(sn="123456789"))
processors = data["processors"]
self.assertEqual(len(processors), 4)
self.assertEqual(processors[0]["label"], "ziew")
self.assertEqual(processors[0]["model_name"], "CPU Xeon 2533MHz, 4-core")
self.assertEqual(processors[0]["cores"], 4)
self.assertEqual(processors[3]["index"], 3)
示例2: test_processors
# 需要導入模塊: from ralph.discovery.models import Processor [as 別名]
# 或者: from ralph.discovery.models.Processor import save [as 別名]
def test_processors(self):
model = ComponentModel(
type=ComponentType.processor,
name="CPU Xeon 2533MHz, 4-core",
)
model.save()
for i in xrange(4):
p = Processor(
label="ziew",
model=model,
device=self.device,
index=i,
)
p.save()
data = get_device_data(Device.objects.get(sn='123456789'))
processors = data['processors']
self.assertEqual(len(processors), 4)
self.assertEqual(processors[0]['label'], "ziew")
self.assertEqual(processors[0]['model_name'], "CPU Xeon 2533MHz, 4-core")
self.assertEqual(processors[0]['cores'], 4)
self.assertEqual(processors[3]['index'], 3)