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