本文整理汇总了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)