예제 #1
0
 def test_verify(self):
     exist = self.mox.CreateMockAnything()
     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')
     dbverifier._mark_exists_failed(exist)
     self.mox.ReplayAll()
     dbverifier._verify(exist)
     self.mox.VerifyAll()
예제 #2
0
 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()
예제 #3
0
 def test_verify_no_launched_at(self):
     exist = self.mox.CreateMockAnything()
     exist.launched_at = None
     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._mark_exist_failed(exist,
                                   reason="Exists without a launched_at")
     self.mox.ReplayAll()
     dbverifier._verify(exist)
     self.mox.VerifyAll()
예제 #4
0
 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()
예제 #5
0
 def test_verify_no_launched_at(self):
     exist = self.mox.CreateMockAnything()
     exist.launched_at = None
     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._mark_exist_failed(exist,
                                   reason="Exists without a launched_at")
     self.mox.ReplayAll()
     dbverifier._verify(exist)
     self.mox.VerifyAll()
예제 #6
0
 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()
예제 #7
0
 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()
예제 #8
0
 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()
예제 #9
0
 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()
예제 #10
0
 def test_verify_no_launched_at(self):
     exist = self.mox.CreateMockAnything()
     exist.launched_at = None
     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._mark_exist_failed(exist,
                                   reason="Exists without a launched_at")
     self.mox.StubOutWithMock(dbverifier, '_verify_with_reconciled_data')
     dbverifier._verify_with_reconciled_data(exist, mox.IgnoreArg())\
               .AndRaise(NotFound('InstanceReconcile', {}))
     self.mox.ReplayAll()
     result, exists = dbverifier._verify(exist)
     self.assertFalse(result)
     self.mox.VerifyAll()
예제 #11
0
 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()