• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python glance_verifier._verify_for_delete函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中verifier.glance_verifier._verify_for_delete函数的典型用法代码示例。如果您正苦于以下问题:Python _verify_for_delete函数的具体用法?Python _verify_for_delete怎么用?Python _verify_for_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了_verify_for_delete函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: 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


示例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_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


示例4: test_verify_delete

    def test_verify_delete(self):
        exist = self.mox.CreateMockAnything()
        exist.delete = self.mox.CreateMockAnything()
        exist.deleted_at = decimal.Decimal("5.1")
        exist.delete.deleted_at = decimal.Decimal("5.1")
        self.mox.ReplayAll()

        glance_verifier._verify_for_delete(exist)
        self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:9,代码来源:test_glance_verifier.py


示例5: 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)
        exist.mark_verified()
        self.mox.ReplayAll()

        verified, exist = glance_verifier._verify(exist)

        self.mox.VerifyAll()
        self.assertTrue(verified)
开发者ID:thomasem,项目名称:stacktach,代码行数:13,代码来源:test_glance_verifier.py


示例6: test_verify_delete_deleted_at_mismatch

    def test_verify_delete_deleted_at_mismatch(self):
        exist = self.mox.CreateMockAnything()
        exist.delete = self.mox.CreateMockAnything()
        exist.deleted_at = decimal.Decimal('5.1')
        exist.delete.deleted_at = decimal.Decimal('4.1')
        self.mox.ReplayAll()

        with self.assertRaises(FieldMismatch) as fm:
            glance_verifier._verify_for_delete(exist)
        exception = fm.exception
        self.assertEqual(exception.field_name, 'deleted_at')
        self.assertEqual(exception.expected, decimal.Decimal('5.1'))
        self.assertEqual(exception.actual, decimal.Decimal('4.1'))
        self.mox.VerifyAll()
开发者ID:thomasem,项目名称:stacktach,代码行数:14,代码来源:test_glance_verifier.py


示例7: test_verify_delete_when_no_delete

    def test_verify_delete_when_no_delete(self):
        exist = self.mox.CreateMockAnything()
        exist.delete = None
        exist.uuid = IMAGE_UUID_1
        exist.deleted_at = None
        audit_period_ending = decimal.Decimal("1.2")
        exist.audit_period_ending = audit_period_ending

        results = self.mox.CreateMockAnything()
        models.ImageDeletes.find(IMAGE_UUID_1, dt.dt_from_decimal(audit_period_ending)).AndReturn(results)
        results.count().AndReturn(0)

        self.mox.ReplayAll()

        glance_verifier._verify_for_delete(exist)
        self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:16,代码来源:test_glance_verifier.py


示例8: test_verify_delete_when_late_delete

    def test_verify_delete_when_late_delete(self):
        exist = self.mox.CreateMockAnything()
        exist.uuid = IMAGE_UUID_1
        exist.delete = None
        exist.deleted_at = decimal.Decimal("5.1")
        results = self.mox.CreateMockAnything()
        models.ImageDeletes.find(uuid=IMAGE_UUID_1).AndReturn(results)
        results.count().AndReturn(1)
        delete = self.mox.CreateMockAnything()
        delete.deleted_at = decimal.Decimal("5.1")
        results.__getitem__(0).AndReturn(delete)

        self.mox.ReplayAll()

        glance_verifier._verify_for_delete(exist)
        self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:16,代码来源:test_glance_verifier.py


示例9: test_verify_for_delete_size_mismatch

    def test_verify_for_delete_size_mismatch(self):
        exist = self.mox.CreateMockAnything()
        exist.delete = self.mox.CreateMockAnything()
        exist.launched_at = decimal.Decimal('1.1')
        exist.deleted_at = decimal.Decimal('5.1')
        exist.delete.launched_at = decimal.Decimal('1.1')
        exist.delete.deleted_at = decimal.Decimal('6.1')
        self.mox.ReplayAll()

        try:
            glance_verifier._verify_for_delete(exist)
            self.fail()
        except FieldMismatch, fm:
            self.assertEqual(fm.field_name, 'deleted_at')
            self.assertEqual(fm.expected, decimal.Decimal('5.1'))
            self.assertEqual(fm.actual, decimal.Decimal('6.1'))
开发者ID:thomasem,项目名称:stacktach,代码行数:16,代码来源:test_glance_verifier.py


示例10: 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


示例11: test_verify_delete_deleted_at_mismatch

    def test_verify_delete_deleted_at_mismatch(self):
        utils.mock_datetime_utcnow(self.mox, "2014-01-02 03:04:05")

        exist = self.mox.CreateMockAnything()
        exist.uuid = IMAGE_UUID_1
        exist.delete = self.mox.CreateMockAnything()
        exist.deleted_at = DELETED_AT_1
        exist.delete.deleted_at = DELETED_AT_2
        self.mox.ReplayAll()

        with self.assertRaises(FieldMismatch) as fm:
            glance_verifier._verify_for_delete(exist)
        exception = fm.exception
        entity_1 = {"name": "exists", "value": DELETED_AT_1}
        entity_2 = {"name": "deletes", "value": DELETED_AT_2}
        self.assertEqual(exception.field_name, "deleted_at")
        self.assertEqual(exception.entity_1, entity_1)
        self.assertEqual(exception.entity_2, entity_2)
        self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:19,代码来源:test_glance_verifier.py


示例12: test_verify_delete_found_delete_when_exist_deleted_at_is_none

    def test_verify_delete_found_delete_when_exist_deleted_at_is_none(self):
        exist = self.mox.CreateMockAnything()
        exist.delete = None
        exist.uuid = IMAGE_UUID_1
        audit_period_ending = decimal.Decimal("1.3")
        exist.deleted_at = None
        exist.audit_period_ending = audit_period_ending
        results = self.mox.CreateMockAnything()
        models.ImageDeletes.find(IMAGE_UUID_1, dt.dt_from_decimal(audit_period_ending)).AndReturn(results)
        results.count().AndReturn(1)

        self.mox.ReplayAll()

        with self.assertRaises(VerificationException) as ve:
            glance_verifier._verify_for_delete(exist)
        exception = ve.exception
        self.assertEqual(exception.reason, "Found ImageDeletes for non-delete exist")

        self.mox.VerifyAll()
开发者ID:rainsome-org1,项目名称:stacktach,代码行数:19,代码来源:test_glance_verifier.py



注:本文中的verifier.glance_verifier._verify_for_delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python glance_verifier._verify_for_usage函数代码示例发布时间:2022-05-26
下一篇:
Python dbverifier._verify_for_launch函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap