

def test_missing_exists_for_instance(self):
    launch = self._fake_usage(mock_deployment=True)
    launched_at = launch.launched_at
    deleted_at = (launched_at + (60 * 30))
    period_beginning = (deleted_at + 1)
    models.InstanceUsage.objects.get(id=launch.id).AndReturn(launch)
    rec_inst = self._fake_reconciler_instance(deleted=True, deleted_at=deleted_at)
    self.client.get_instance('RegionOne', INSTANCE_ID_1).AndReturn(rec_inst)
    reconcile_vals = {
        'instance': launch.instance,
        'launched_at': launch.launched_at,
        'deleted_at': deleted_at,
        'instance_type_id': launch.instance_type_id,
        'instance_flavor_id': launch.instance_flavor_id,
        'source': 'reconciler:mocked_client',
        'tenant': TENANT_ID_1,
        'os_architecture': DEFAULT_OS_ARCH,
        'os_distro': DEFAULT_OS_DISTRO,
        'os_version': DEFAULT_OS_VERSION,
        'rax_options': DEFAULT_RAX_OPTIONS,
    }
    result = self.mox.CreateMockAnything()
    models.InstanceReconcile(**reconcile_vals).AndReturn(result)
    result.save()
    self.mox.ReplayAll()
    result = self.reconciler.missing_exists_for_instance(launch.id, period_beginning)
    self.assertTrue(result)
    self.mox.VerifyAll()

dataset/ETHPy150Open openstack/stacktach/tests/unit/test_reconciler.py ReconcilerTestCase.test_missing_exists_for_instance/original