]>
Commit | Line | Data |
---|---|---|
92f5a8d4 | 1 | # -*- coding: utf-8 -*- |
92f5a8d4 | 2 | |
a4b75251 | 3 | from ..tests import CLICommandTestMixin, ControllerTestCase |
92f5a8d4 TL |
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 | ||
9f95a23c | 21 | data = self.json_body() |
92f5a8d4 TL |
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 | ||
9f95a23c | 33 | data = self.json_body() |
92f5a8d4 TL |
34 | self.assertGreater(len(data), 0) |
35 | self.assertIn('traceback', data) | |
36 | self.assertIn('version', data) | |
37 | self.assertIn('request_id', data) |