本文整理汇总了Python中verifier.dbverifier._verify_for_launch函数的典型用法代码示例。如果您正苦于以下问题:Python _verify_for_launch函数的具体用法?Python _verify_for_launch怎么用?Python _verify_for_launch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_verify_for_launch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_verify_for_launch_late_usage
def test_verify_for_launch_late_usage(self):
exist = self.mox.CreateMockAnything()
exist.usage = None
exist.instance = INSTANCE_ID_1
exist.launched_at = decimal.Decimal('1.1')
exist.instance_type_id = 2
results = self.mox.CreateMockAnything()
models.InstanceUsage.objects.filter(instance=INSTANCE_ID_1)\
.AndReturn(results)
results.count().AndReturn(1)
filters = {
'instance': INSTANCE_ID_1,
'launched_at__gte': decimal.Decimal('1.0'),
'launched_at__lte': decimal.Decimal('1.999999')
}
models.InstanceUsage.objects.filter(**filters).AndReturn(results)
results.count().AndReturn(1)
usage = self.mox.CreateMockAnything()
results.__getitem__(0).AndReturn(usage)
usage.launched_at = decimal.Decimal('1.1')
usage.instance_type_id = 2
self.mox.ReplayAll()
dbverifier._verify_for_launch(exist)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:25,代码来源:test_verifier_db.py
示例2: test_verify_for_launch_late_ambiguous_usage
def test_verify_for_launch_late_ambiguous_usage(self):
exist = self.mox.CreateMockAnything()
exist.usage = None
exist.instance = INSTANCE_ID_1
exist.launched_at = decimal.Decimal('1.1')
exist.instance_type_id = 2
results = self.mox.CreateMockAnything()
models.InstanceUsage.objects.filter(instance=INSTANCE_ID_1) \
.AndReturn(results)
results.count().AndReturn(1)
filters = {
'instance': INSTANCE_ID_1,
'launched_at__gte': decimal.Decimal('1.0'),
'launched_at__lte': decimal.Decimal('1.999999')
}
models.InstanceUsage.objects.filter(**filters).AndReturn(results)
results.count().AndReturn(2)
self.mox.ReplayAll()
try:
dbverifier._verify_for_launch(exist)
self.fail()
except AmbiguousResults, nf:
self.assertEqual(nf.object_type, 'InstanceUsage')
search_params = {'instance': INSTANCE_ID_1,
'launched_at': decimal.Decimal('1.1')}
self.assertEqual(nf.search_params, search_params)
开发者ID:kiall,项目名称:stacktach,代码行数:27,代码来源:test_verifier_db.py
示例3: test_verify_for_launch
def test_verify_for_launch(self):
exist = self.mox.CreateMockAnything()
exist.usage = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
exist.instance_type_id = 2
exist.usage.launched_at = decimal.Decimal('1.1')
exist.usage.instance_type_id = 2
self.mox.ReplayAll()
dbverifier._verify_for_launch(exist)
self.mox.VerifyAll()
开发者ID:mendeni,项目名称:stacktach,代码行数:11,代码来源:test_verifier_db.py
示例4: test_verify_exception_during_launch
def test_verify_exception_during_launch(self):
exist = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
self.mox.StubOutWithMock(dbverifier, '_verify_for_launch')
self.mox.StubOutWithMock(dbverifier, '_verify_for_delete')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_failed')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_verified')
dbverifier._verify_for_launch(exist).AndRaise(Exception())
dbverifier._mark_exist_failed(exist, reason='Exception')
self.mox.ReplayAll()
dbverifier._verify(exist)
self.mox.VerifyAll()
开发者ID:mendeni,项目名称:stacktach,代码行数:12,代码来源:test_verifier_db.py
示例5: test_verify_pass
def test_verify_pass(self):
exist = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
self.mox.StubOutWithMock(dbverifier, '_verify_for_launch')
self.mox.StubOutWithMock(dbverifier, '_verify_for_delete')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_failed')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_verified')
dbverifier._verify_for_launch(exist)
dbverifier._verify_for_delete(exist)
dbverifier._mark_exist_verified(exist)
self.mox.ReplayAll()
dbverifier._verify(exist)
self.mox.VerifyAll()
开发者ID:mendeni,项目名称:stacktach,代码行数:13,代码来源:test_verifier_db.py
示例6: test_verify_launch_fail
def test_verify_launch_fail(self):
exist = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
self.mox.StubOutWithMock(dbverifier, '_verify_for_launch')
self.mox.StubOutWithMock(dbverifier, '_verify_for_delete')
self.mox.StubOutWithMock(dbverifier, '_mark_exists_failed')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_verified')
verify_exception = VerificationException('test')
dbverifier._verify_for_launch(exist).AndRaise(verify_exception)
dbverifier._mark_exists_failed(exist)
self.mox.ReplayAll()
dbverifier._verify(exist)
self.mox.VerifyAll()
开发者ID:AsherBond,项目名称:stacktach,代码行数:13,代码来源:test_verifier_db.py
示例7: test_verify_for_launch
def test_verify_for_launch(self):
exist = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
exist.instance_type_id = INSTANCE_TYPE_ID_1
exist.tenant = TENANT_ID_1
exist.usage = self.mox.CreateMockAnything()
exist.usage.launched_at = decimal.Decimal('1.1')
exist.usage.instance_type_id = INSTANCE_TYPE_ID_1
exist.usage.tenant = TENANT_ID_1
self.mox.ReplayAll()
dbverifier._verify_for_launch(exist)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:15,代码来源:test_verifier_db.py
示例8: test_verify_fail_reconcile_success
def test_verify_fail_reconcile_success(self):
exist = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
self.mox.StubOutWithMock(dbverifier, '_verify_for_launch')
self.mox.StubOutWithMock(dbverifier, '_verify_for_delete')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_failed')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_verified')
verify_exception = VerificationException('test')
dbverifier._verify_for_launch(exist).AndRaise(verify_exception)
self.mox.StubOutWithMock(dbverifier, '_verify_with_reconciled_data')
dbverifier._verify_with_reconciled_data(exist, verify_exception)
dbverifier._mark_exist_verified(exist)
self.mox.ReplayAll()
result, exists = dbverifier._verify(exist)
self.assertTrue(result)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:16,代码来源:test_verifier_db.py
示例9: test_verify_for_launch_instance_type_id_missmatch
def test_verify_for_launch_instance_type_id_missmatch(self):
exist = self.mox.CreateMockAnything()
exist.usage = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
exist.instance_type_id = 2
exist.usage.launched_at = decimal.Decimal('1.1')
exist.usage.instance_type_id = 3
self.mox.ReplayAll()
try:
dbverifier._verify_for_launch(exist)
self.fail()
except FieldMismatch, fm:
self.assertEqual(fm.field_name, 'instance_type_id')
self.assertEqual(fm.expected, 2)
self.assertEqual(fm.actual, 3)
开发者ID:kiall,项目名称:stacktach,代码行数:16,代码来源:test_verifier_db.py
示例10: test_verify_launch_fail
def test_verify_launch_fail(self):
exist = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.1')
self.mox.StubOutWithMock(dbverifier, '_verify_for_launch')
self.mox.StubOutWithMock(dbverifier, '_verify_for_delete')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_failed')
self.mox.StubOutWithMock(dbverifier, '_mark_exist_verified')
verify_exception = VerificationException('test')
dbverifier._verify_for_launch(exist).AndRaise(verify_exception)
self.mox.StubOutWithMock(dbverifier, '_verify_with_reconciled_data')
dbverifier._verify_with_reconciled_data(exist, verify_exception)\
.AndRaise(NotFound('InstanceReconcile', {}))
dbverifier._mark_exist_failed(exist, reason='test')
self.mox.ReplayAll()
result, exists = dbverifier._verify(exist)
self.assertFalse(result)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:17,代码来源:test_verifier_db.py
示例11: test_verify_for_launch_os_version_mismatch
def test_verify_for_launch_os_version_mismatch(self):
exist = self.mox.CreateMockAnything()
exist.os_version = OS_VERSION_1
exist.usage = self.mox.CreateMockAnything()
exist.usage.os_version = OS_VERSION_2
self.mox.ReplayAll()
with self.assertRaises(FieldMismatch) as cm:
dbverifier._verify_for_launch(exist)
exception = cm.exception
self.assertEqual(exception.field_name, 'os_version')
self.assertEqual(exception.expected, OS_VERSION_1)
self.assertEqual(exception.actual, OS_VERSION_2)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:17,代码来源:test_verifier_db.py
示例12: test_verify_for_launch_rax_options_mismatch
def test_verify_for_launch_rax_options_mismatch(self):
exist = self.mox.CreateMockAnything()
exist.rax_options = RAX_OPTIONS_1
exist.usage = self.mox.CreateMockAnything()
exist.usage.rax_options = RAX_OPTIONS_2
self.mox.ReplayAll()
with self.assertRaises(FieldMismatch) as cm:
dbverifier._verify_for_launch(exist)
exception = cm.exception
self.assertEqual(exception.field_name, 'rax_options')
self.assertEqual(exception.expected, RAX_OPTIONS_1)
self.assertEqual(exception.actual, RAX_OPTIONS_2)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:17,代码来源:test_verifier_db.py
示例13: test_verify_for_launch_tenant_id_mismatch
def test_verify_for_launch_tenant_id_mismatch(self):
exist = self.mox.CreateMockAnything()
exist.tenant = TENANT_ID_1
exist.usage = self.mox.CreateMockAnything()
exist.usage.tenant = TENANT_ID_2
self.mox.ReplayAll()
with self.assertRaises(FieldMismatch) as cm:
dbverifier._verify_for_launch(exist)
exception = cm.exception
self.assertEqual(exception.field_name, 'tenant')
self.assertEqual(exception.expected, TENANT_ID_1)
self.assertEqual(exception.actual, TENANT_ID_2)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:17,代码来源:test_verifier_db.py
示例14: test_verify_for_launch_no_usage
def test_verify_for_launch_no_usage(self):
exist = self.mox.CreateMockAnything()
exist.usage = None
exist.instance = INSTANCE_ID_1
exist.launched_at = decimal.Decimal('1.1')
exist.instance_type_id = 2
results = self.mox.CreateMockAnything()
models.InstanceUsage.objects.filter(instance=INSTANCE_ID_1) \
.AndReturn(results)
results.count().AndReturn(0)
self.mox.ReplayAll()
try:
dbverifier._verify_for_launch(exist)
self.fail()
except NotFound, nf:
self.assertEqual(nf.object_type, 'InstanceUsage')
self.assertEqual(nf.search_params, {'instance': INSTANCE_ID_1})
开发者ID:kiall,项目名称:stacktach,代码行数:18,代码来源:test_verifier_db.py
示例15: test_verify_for_launch_launched_at_in_range
def test_verify_for_launch_launched_at_in_range(self):
exist = self.mox.CreateMockAnything()
exist.usage = self.mox.CreateMockAnything()
exist.launched_at = decimal.Decimal('1.0')
exist.instance_type_id = 2
exist.usage.launched_at = decimal.Decimal('1.4')
exist.usage.instance_type_id = 2
self.mox.ReplayAll()
result = dbverifier._verify_for_launch(exist)
self.assertIsNone(result)
self.mox.VerifyAll()
开发者ID:kiall,项目名称:stacktach,代码行数:13,代码来源:test_verifier_db.py
注:本文中的verifier.dbverifier._verify_for_launch函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论