def test_instance_create_overlimit(self):
        t = template_format.parse(db_template)
        instance = self._setup_test_instance('dbinstance_create', t)

        # Simulate an OverLimit exception
        self.client.instances.get.side_effect = [
            troveexc.RequestEntityTooLarge(), self.fake_instance
        ]

        scheduler.TaskRunner(instance.create)()
        self.assertEqual((instance.CREATE, instance.COMPLETE), instance.state)
    def test_instance_delete_overlimit(self):
        t = template_format.parse(db_template)
        instance = self._setup_test_instance('dbinstance_del', t)

        # Simulate an OverLimit exception
        self.client.instances.get.side_effect = [
            troveexc.RequestEntityTooLarge(), self.fake_instance,
            troveexc.NotFound(404)
        ]

        scheduler.TaskRunner(instance.create)()
        scheduler.TaskRunner(instance.delete)()