]> git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/tests/test_plugin_debug.py
import quincy beta 17.1.0
[ceph.git] / ceph / src / pybind / mgr / dashboard / tests / test_plugin_debug.py
1 # -*- coding: utf-8 -*-
2
3 from ..tests import CLICommandTestMixin, ControllerTestCase
4
5
6 class TestPluginDebug(ControllerTestCase, CLICommandTestMixin):
7 @classmethod
8 def setup_server(cls):
9 # pylint: disable=protected-access
10 cls.setup_controllers([])
11
12 def setUp(self):
13 self.mock_kv_store()
14
15 def test_debug_disabled(self):
16 self.exec_cmd('debug', action='disable')
17
18 self._get('/api/unexisting_controller')
19 self.assertStatus(404)
20
21 data = self.json_body()
22 self.assertGreater(len(data), 0)
23 self.assertNotIn('traceback', data)
24 self.assertNotIn('version', data)
25 self.assertIn('request_id', data)
26
27 def test_debug_enabled(self):
28 self.exec_cmd('debug', action='enable')
29
30 self._get('/api/unexisting_controller')
31 self.assertStatus(404)
32
33 data = self.json_body()
34 self.assertGreater(len(data), 0)
35 self.assertIn('traceback', data)
36 self.assertIn('version', data)
37 self.assertIn('request_id', data)