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