mirror of
https://github.com/ceph/ceph
synced 2025-04-10 03:32:25 +00:00
Versioning is handled by the RESTContoller decorators. It works by adding a version attribute to the endpoint object, which will be checked by the _request_wrapper against the requested version before the controller method is dispatched. This commit also updates all of the testing to support version vendor mime types, as well as adding an http interceptor to add versioned mime types to all frontend requests. Fixes: https://tracker.ceph.com/issues/40909 Signed-off-by: Avan Thakkar <athakkar@redhat.com>
21 lines
553 B
Python
21 lines
553 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import absolute_import
|
|
|
|
import unittest
|
|
|
|
from . import DEFAULT_VERSION
|
|
from .helper import DashboardTestCase
|
|
|
|
|
|
class VersionReqTest(DashboardTestCase, unittest.TestCase):
|
|
def test_version(self):
|
|
for (version, expected_status) in [
|
|
(DEFAULT_VERSION, 200),
|
|
(None, 415),
|
|
("99.99", 415)
|
|
]:
|
|
with self.subTest(version=version):
|
|
self._get('/api/summary', version=version)
|
|
self.assertStatus(expected_status)
|