Ejemplo n.º 1
0
    def test_is_supported_max_version(self):
        req = fakes.HTTPRequest.blank('/fake', version='2.4')

        self.assertFalse(
            api_version_request.is_supported(req, max_version='1.0'))
        self.assertTrue(
            api_version_request.is_supported(req, max_version='2.6'))
Ejemplo n.º 2
0
    def show(self, req, id):
        """Return data about the given notification id."""
        context = req.environ['masakari.context']
        context.can(notifications_policies.NOTIFICATIONS % 'detail')

        try:
            if api_version_request.is_supported(req, min_version='1.1'):
                notification = (
                    self.api.get_notification_recovery_workflow_details(
                        context, id))
            else:
                notification = self.api.get_notification(context, id)
        except exception.NotificationNotFound as err:
            raise exc.HTTPNotFound(explanation=err.format_message())
        return {'notification': notification}