ceph/qa/tasks/mgr/dashboard/test_api.py
Christopher Odom dcac50e322 mgr/dashboard: Added Versioning to the REST API
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>
2020-10-28 19:33:39 +05:30

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)