def test_send_status_batch_not_found(self):
        fake_request = self.mox.CreateMockAnything()
        fake_request.method = 'PUT'
        messages = {
            MESSAGE_ID_1: '201',
        }
        body_dict = {'messages': messages}
        body = json.dumps(body_dict)
        fake_request.body = body
        self.mox.StubOutWithMock(transaction, 'commit_on_success')
        trans_obj = self.mox.CreateMockAnything()
        transaction.commit_on_success().AndReturn(trans_obj)
        trans_obj.__enter__()
        results = self.mox.CreateMockAnything()
        models.InstanceExists.objects.select_for_update().AndReturn(results)
        exception = models.InstanceExists.DoesNotExist()
        results.get(message_id=MESSAGE_ID_1).AndRaise(exception)
        trans_obj.__exit__(dbapi.NotFoundException().__class__,
                           mox.IgnoreArg(),
                           mox.IgnoreArg())
        self.mox.ReplayAll()

        resp = dbapi.exists_send_status(fake_request, 'batch')
        self.assertEqual(resp.status_code, 404)
        body = json.loads(resp.content)
        self.assertEqual(body.get("status"), 404)
        msg = "Could not find Exists record with message_id = '%s' for nova"
        msg = msg % MESSAGE_ID_1
        self.assertEqual(body.get("message"), msg)
        self.mox.VerifyAll()
dataset/ETHPy150Open openstack/stacktach/tests/unit/test_dbapi.py/DBAPITestCase.test_send_status_batch_not_found/original