Total Complexity | 3 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Coverage | 100% |
1 | """Tests what happens if the config file is invalid.""" |
||
18 | 1 | class InvalidConfFileTestCase(TestCase): |
|
19 | 1 | def setUp(self): |
|
20 | 1 | super(InvalidConfFileTestCase, self).setUp() |
|
21 | 1 | self.app = TestApp(app) |
|
22 | 1 | self.config_file = tempfile.NamedTemporaryFile('w+') |
|
23 | 1 | os.environ['PPP_LOGGER_CONFIG'] = self.config_file.name |
|
24 | 1 | def tearDown(self): |
|
25 | 1 | del os.environ['PPP_LOGGER_CONFIG'] |
|
26 | 1 | self.config_file.close() |
|
27 | 1 | del self.config_file |
|
28 | 1 | super(InvalidConfFileTestCase, self).tearDown() |
|
29 | 1 | def testEmptyConfFile(self): |
|
30 | 1 | obj = {'id': 'foobar', 'question': '42?', 'responses': []} |
|
31 | 1 | self.assertRaises(InvalidConfig, self.app.post_json, |
|
32 | '/', obj, status='*') |
||
33 |