本文整理汇总了Python中ovs.dal.hybrids.t_testdisk.TestDisk.description方法的典型用法代码示例。如果您正苦于以下问题:Python TestDisk.description方法的具体用法?Python TestDisk.description怎么用?Python TestDisk.description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ovs.dal.hybrids.t_testdisk.TestDisk
的用法示例。
在下文中一共展示了TestDisk.description方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_mandatory_fields
# 需要导入模块: from ovs.dal.hybrids.t_testdisk import TestDisk [as 别名]
# 或者: from ovs.dal.hybrids.t_testdisk.TestDisk import description [as 别名]
def test_mandatory_fields(self):
"""
Validates whether mandatory properties and relations work
"""
machine = TestMachine()
machine.extended = 'extended'
machine.name = 'machine'
machine.save()
disk = TestDisk()
# Modify relation to mandatory
[_ for _ in disk._relations if _.name == 'machine'][0].mandatory = True
# Continue test
disk.name = None
with self.assertRaises(MissingMandatoryFieldsException) as exception:
disk.save()
self.assertIn('name', exception.exception.message, 'Field name should be in exception message: {0}'.format(exception.exception.message))
self.assertIn('machine', exception.exception.message, 'Field machine should be in exception message: {0}'.format(exception.exception.message))
disk.name = 'disk'
disk.machine = machine
disk.save()
disk.description = 'test'
disk.storage = machine
disk.save()
# Restore relation
[_ for _ in disk._relations if _.name == 'machine'][0].mandatory = False
示例2: test_updateproperty
# 需要导入模块: from ovs.dal.hybrids.t_testdisk import TestDisk [as 别名]
# 或者: from ovs.dal.hybrids.t_testdisk.TestDisk import description [as 别名]
def test_updateproperty(self):
"""
Validates the behavior regarding updating properties
"""
disk = TestDisk()
disk.name = 'test'
disk.description = 'desc'
# A property should be writable
self.assertIs(disk.name, 'test', 'Property should be updated')
self.assertIs(disk.description, 'desc', 'Property should be updated')