本文整理汇总了Python中verifier.glance_verifier._verify_validity函数的典型用法代码示例。如果您正苦于以下问题:Python _verify_validity函数的具体用法?Python _verify_validity怎么用?Python _verify_validity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_verify_validity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_verify_exist_marks_exist_failed_if_field_mismatch_exception
def test_verify_exist_marks_exist_failed_if_field_mismatch_exception(self):
self.mox.StubOutWithMock(datetime, 'datetime')
datetime.datetime.utcnow().AndReturn('2014-01-01 01:01:01')
self.mox.ReplayAll()
exist1 = self.mox.CreateMockAnything()
exist2 = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(glance_verifier, '_verify_for_usage')
self.mox.StubOutWithMock(glance_verifier, '_verify_for_delete')
self.mox.StubOutWithMock(glance_verifier, '_verify_validity')
field_mismatch_exc = FieldMismatch('field', 'expected',
'actual', 'uuid')
glance_verifier._verify_for_usage(exist1).AndRaise(
exception=field_mismatch_exc)
exist1.mark_failed(
reason="Failed at 2014-01-01 01:01:01 UTC for uuid: Expected "
"field to be 'expected' got 'actual'")
glance_verifier._verify_for_usage(exist2)
glance_verifier._verify_for_delete(exist2)
glance_verifier._verify_validity(exist2)
exist2.mark_verified()
self.mox.ReplayAll()
verified, exist = glance_verifier._verify([exist1, exist2])
self.mox.VerifyAll()
self.assertFalse(verified)
开发者ID:DragonDM,项目名称:stacktach,代码行数:28,代码来源:test_glance_verifier.py
示例2: test_verify_exist_marks_exist_failed_if_field_mismatch_exception
def test_verify_exist_marks_exist_failed_if_field_mismatch_exception(self):
mock_logger = self._setup_mock_logger()
self.mox.StubOutWithMock(mock_logger, 'info')
mock_logger.exception("glance: Expected field to be 'expected' "
"got 'actual'")
exist1 = self.mox.CreateMockAnything()
exist2 = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(glance_verifier, '_verify_for_usage')
self.mox.StubOutWithMock(glance_verifier, '_verify_for_delete')
self.mox.StubOutWithMock(glance_verifier, '_verify_validity')
field_mismatch_exc = FieldMismatch('field', 'expected', 'actual')
glance_verifier._verify_for_usage(exist1).AndRaise(
exception=field_mismatch_exc)
exist1.mark_failed(reason='FieldMismatch')
glance_verifier._verify_for_usage(exist2)
glance_verifier._verify_for_delete(exist2)
glance_verifier._verify_validity(exist2)
exist2.mark_verified()
self.mox.ReplayAll()
verified, exist = glance_verifier._verify([exist1, exist2])
self.mox.VerifyAll()
self.assertFalse(verified)
开发者ID:souvikbasu,项目名称:stacktach,代码行数:27,代码来源:test_glance_verifier.py
示例3: test_should_verify_owner_is_of_type_hex
def test_should_verify_owner_is_of_type_hex(self):
self.mox.StubOutWithMock(datetime, 'datetime')
datetime.datetime.utcnow().AndReturn('2014-01-02 03:04:05')
self.mox.ReplayAll()
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 1234L
exist.created_at = decimal.Decimal('5.1')
exist.uuid = "58fb036d-5ef8-47a8-b503-7571276c400a"
exist.owner = "3762854cd6f6435998188d5120e4c271,kl"
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except WrongTypeException as wt:
self.assertEqual(wt.field_name, 'owner')
self.assertEqual(
wt.reason,
"Failed at 2014-01-02 03:04:05 UTC for "
"58fb036d-5ef8-47a8-b503-7571276c400a: "
"{owner: 3762854cd6f6435998188d5120e4c271,kl} was of "
"incorrect type for exist id 23")
self.mox.VerifyAll()
开发者ID:DragonDM,项目名称:stacktach,代码行数:25,代码来源:test_glance_verifier.py
示例4: test_verify_exist_marks_exist_failed_if_field_mismatch_exception
def test_verify_exist_marks_exist_failed_if_field_mismatch_exception(self):
utils.mock_datetime_utcnow(self.mox, "2014-01-02 03:04:05")
exist1 = self.mox.CreateMockAnything()
exist2 = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(glance_verifier, "_verify_for_usage")
self.mox.StubOutWithMock(glance_verifier, "_verify_for_delete")
self.mox.StubOutWithMock(glance_verifier, "_verify_validity")
entity_1 = {"name": "exists", "value": "expected"}
entity_2 = {"name": "launches", "value": "actual"}
field_mismatch_exc = FieldMismatch("field", entity_1, entity_2, "uuid")
glance_verifier._verify_for_usage(exist1).AndRaise(exception=field_mismatch_exc)
exist1.mark_failed(
reason="Failed at 2014-01-02 03:04:05 UTC for uuid: Data mismatch "
"for 'field' - 'exists' contains 'expected' but 'launches' "
"contains 'actual'"
)
glance_verifier._verify_for_usage(exist2)
glance_verifier._verify_for_delete(exist2)
glance_verifier._verify_validity(exist2)
exist2.mark_verified()
self.mox.ReplayAll()
verified, exist = glance_verifier._verify([exist1, exist2])
self.mox.VerifyAll()
self.assertFalse(verified)
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:27,代码来源:test_glance_verifier.py
示例5: test_should_verify_correctly_for_all_non_null_and_valid_types
def test_should_verify_correctly_for_all_non_null_and_valid_types(self):
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 983040L
exist.created_at = decimal.Decimal("5.1")
exist.uuid = "58fb036d-5ef8-47a8-b503-7571276c400a"
exist.owner = "3762854cd6f6435998188d5120e4c271"
self.mox.ReplayAll()
glance_verifier._verify_validity(exist)
self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:11,代码来源:test_glance_verifier.py
示例6: test_verify_should_verify_exists_for_usage_and_delete
def test_verify_should_verify_exists_for_usage_and_delete(self):
exist = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(glance_verifier, '_verify_for_usage')
glance_verifier._verify_for_usage(exist)
self.mox.StubOutWithMock(glance_verifier, '_verify_for_delete')
glance_verifier._verify_for_delete(exist)
self.mox.StubOutWithMock(glance_verifier, '_verify_validity')
glance_verifier._verify_validity(exist)
exist.mark_verified()
self.mox.ReplayAll()
verified, exist = glance_verifier._verify(exist)
self.mox.VerifyAll()
self.assertTrue(verified)
开发者ID:anujm,项目名称:stacktach,代码行数:15,代码来源:test_glance_verifier.py
示例7: test_should_verify_that_uuid_in_exist_is_not_null
def test_should_verify_that_uuid_in_exist_is_not_null(self):
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 'size'
exist.created_at = decimal.Decimal('5.1')
exist.uuid = None
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, 'uuid')
self.assertEqual(nf.reason, "uuid field was null for exist id 23")
self.mox.VerifyAll()
开发者ID:souvikbasu,项目名称:stacktach,代码行数:15,代码来源:test_glance_verifier.py
示例8: test_should_verify_image_size_is_of_type_decimal
def test_should_verify_image_size_is_of_type_decimal(self):
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 'size'
exist.created_at = decimal.Decimal('5.1')
exist.uuid = "58fb036d-5ef8-47a8-b503-7571276c400a"
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except WrongTypeException as wt:
self.assertEqual(wt.field_name, 'size')
self.assertEqual(wt.reason, "{ size : size } of incorrect type for exist id 23")
self.mox.VerifyAll()
开发者ID:souvikbasu,项目名称:stacktach,代码行数:15,代码来源:test_glance_verifier.py
示例9: test_should_verify_that_uuid_value_is_uuid_like
def test_should_verify_that_uuid_value_is_uuid_like(self):
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 'size'
exist.created_at = decimal.Decimal('5.1')
exist.uuid = "asdfe-fgh"
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except WrongTypeException as wt:
self.assertEqual(wt.field_name, 'uuid')
self.assertEqual(wt.reason, "{ uuid : asdfe-fgh } of incorrect type for exist id 23")
self.mox.VerifyAll()
开发者ID:souvikbasu,项目名称:stacktach,代码行数:15,代码来源:test_glance_verifier.py
示例10: test_should_verify_owner_is_of_type_hex
def test_should_verify_owner_is_of_type_hex(self):
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 1234L
exist.created_at = decimal.Decimal('5.1')
exist.uuid = "58fb036d-5ef8-47a8-b503-7571276c400a"
exist.owner = "3762854cd6f6435998188d5120e4c271,kl"
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except WrongTypeException as wt:
self.assertEqual(wt.field_name, 'owner')
self.assertEqual(wt.reason, "{ owner : 3762854cd6f6435998188d5120e4c271,kl } of incorrect type for exist id 23")
self.mox.VerifyAll()
开发者ID:souvikbasu,项目名称:stacktach,代码行数:16,代码来源:test_glance_verifier.py
示例11: test_verify_should_verify_exists_for_usage_and_delete
def test_verify_should_verify_exists_for_usage_and_delete(self):
exist1 = self.mox.CreateMockAnything()
exist2 = self.mox.CreateMockAnything()
self.mox.StubOutWithMock(glance_verifier, "_verify_for_usage")
self.mox.StubOutWithMock(glance_verifier, "_verify_for_delete")
self.mox.StubOutWithMock(glance_verifier, "_verify_validity")
for exist in [exist1, exist2]:
glance_verifier._verify_for_usage(exist)
glance_verifier._verify_for_delete(exist)
glance_verifier._verify_validity(exist)
exist.mark_verified()
self.mox.ReplayAll()
verified, exist = glance_verifier._verify([exist1, exist2])
self.mox.VerifyAll()
self.assertTrue(verified)
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:18,代码来源:test_glance_verifier.py
示例12: test_should_verify_that_uuid_in_exist_is_not_null
def test_should_verify_that_uuid_in_exist_is_not_null(self):
utils.mock_datetime_utcnow(self.mox, "2014-01-01 01:02:03")
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = "size"
exist.created_at = decimal.Decimal("5.1")
exist.uuid = None
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, "uuid")
self.assertEqual(
nf.reason, "Failed at 2014-01-01 01:02:03 UTC for None: " "uuid field was null for exist id 23"
)
self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:19,代码来源:test_glance_verifier.py
示例13: test_should_verify_that_created_at_in_exist_is_not_null
def test_should_verify_that_created_at_in_exist_is_not_null(self):
utils.mock_datetime_utcnow(self.mox, '2014-01-01 01:02:03')
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 'size'
exist.created_at = None
exist.uuid = IMAGE_UUID_1
self.mox.ReplayAll()
with self.assertRaises(NullFieldException) as nfe:
glance_verifier._verify_validity(exist)
exception = nfe.exception
self.assertEqual(exception.field_name, 'created_at')
self.assertEqual(exception.reason,
"Failed at 2014-01-01 01:02:03 UTC for "
"%s: created_at "
"field was null for exist id 23" % IMAGE_UUID_1)
self.mox.VerifyAll()
开发者ID:openstack,项目名称:stacktach,代码行数:20,代码来源:test_glance_verifier.py
示例14: test_should_verify_that_image_size_in_exist_is_not_null
def test_should_verify_that_image_size_in_exist_is_not_null(self):
utils.mock_datetime_utcnow(self.mox, '2014-01-02 03:04:05')
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = None
exist.created_at = decimal.Decimal('5.1')
exist.uuid = IMAGE_UUID_1
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, 'image_size')
self.assertEqual(
nf.reason, "Failed at 2014-01-02 03:04:05 UTC for "
"%s: image_size field was "
"null for exist id 23" % IMAGE_UUID_1)
self.mox.VerifyAll()
开发者ID:openstack,项目名称:stacktach,代码行数:20,代码来源:test_glance_verifier.py
示例15: test_should_verify_that_uuid_in_exist_is_not_null
def test_should_verify_that_uuid_in_exist_is_not_null(self):
self.mox.StubOutWithMock(datetime, 'datetime')
datetime.datetime.utcnow().AndReturn('2014-01-01 01:02:03')
self.mox.ReplayAll()
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 'size'
exist.created_at = decimal.Decimal('5.1')
exist.uuid = None
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, 'uuid')
self.assertEqual(
nf.reason, "Failed at 2014-01-01 01:02:03 UTC for None: "
"uuid field was null for exist id 23")
self.mox.VerifyAll()
开发者ID:DragonDM,项目名称:stacktach,代码行数:21,代码来源:test_glance_verifier.py
示例16: test_should_verify_that_image_size_in_exist_is_not_null
def test_should_verify_that_image_size_in_exist_is_not_null(self):
utils.mock_datetime_utcnow(self.mox, "2014-01-02 03:04:05")
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = None
exist.created_at = decimal.Decimal("5.1")
exist.uuid = IMAGE_UUID_1
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, "image_size")
self.assertEqual(
nf.reason,
"Failed at 2014-01-02 03:04:05 UTC for "
"12345678-6352-4dbc-8271-96cc54bf14cd: image_size field was "
"null for exist id 23",
)
self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:22,代码来源:test_glance_verifier.py
示例17: test_should_verify_that_owner_in_exist_is_not_null
def test_should_verify_that_owner_in_exist_is_not_null(self):
utils.mock_datetime_utcnow(self.mox, '2014-01-01 01:02:03')
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 1234
exist.created_at = decimal.Decimal('5.1')
exist.uuid = IMAGE_UUID_1
exist.owner = None
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, 'owner')
self.assertEqual(
nf.reason,
"Failed at 2014-01-01 01:02:03 UTC for "
"%s: owner field was null "
"for exist id 23" % IMAGE_UUID_1)
self.mox.VerifyAll()
开发者ID:openstack,项目名称:stacktach,代码行数:22,代码来源:test_glance_verifier.py
示例18: test_should_verify_that_created_at_in_exist_is_not_null
def test_should_verify_that_created_at_in_exist_is_not_null(self):
utils.mock_datetime_utcnow(self.mox, "2014-01-01 01:02:03")
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = "size"
exist.created_at = None
exist.uuid = IMAGE_UUID_1
self.mox.ReplayAll()
with self.assertRaises(NullFieldException) as nfe:
glance_verifier._verify_validity(exist)
exception = nfe.exception
self.assertEqual(exception.field_name, "created_at")
self.assertEqual(
exception.reason,
"Failed at 2014-01-01 01:02:03 UTC for "
"12345678-6352-4dbc-8271-96cc54bf14cd: created_at "
"field was null for exist id 23",
)
self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:22,代码来源:test_glance_verifier.py
示例19: test_should_verify_that_uuid_value_is_uuid_like
def test_should_verify_that_uuid_value_is_uuid_like(self):
self.mox.StubOutWithMock(datetime, 'datetime')
datetime.datetime.utcnow().AndReturn('2014-01-02 03:04:05')
self.mox.ReplayAll()
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 'size'
exist.created_at = decimal.Decimal('5.1')
exist.uuid = "asdfe-fgh"
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except WrongTypeException as wt:
self.assertEqual(wt.field_name, 'uuid')
self.assertEqual(
wt.reason,
"Failed at 2014-01-02 03:04:05 UTC for None: "
"{uuid: asdfe-fgh} was of incorrect type for exist id 23")
self.mox.VerifyAll()
开发者ID:openstack,项目名称:stacktach,代码行数:22,代码来源:test_glance_verifier.py
示例20: test_should_verify_that_owner_in_exist_is_not_null
def test_should_verify_that_owner_in_exist_is_not_null(self):
self.mox.StubOutWithMock(datetime, 'datetime')
datetime.datetime.utcnow().AndReturn('2014-01-02 03:04:05')
self.mox.ReplayAll()
exist = self.mox.CreateMockAnything()
exist.id = 23
exist.size = 1234
exist.created_at = decimal.Decimal('5.1')
exist.uuid = '1234-5678-9012-3456'
exist.owner = None
self.mox.ReplayAll()
try:
glance_verifier._verify_validity(exist)
self.fail()
except NullFieldException as nf:
self.assertEqual(nf.field_name, 'owner')
self.assertEqual(
nf.reason, "Failed at 2014-01-02 03:04:05 UTC for "
"1234-5678-9012-3456: owner field was null for exist id 23")
self.mox.VerifyAll()
开发者ID:DragonDM,项目名称:stacktach,代码行数:22,代码来源:test_glance_verifier.py
注:本文中的verifier.glance_verifier._verify_validity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论