| Total Complexity | 3 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | """Tests what happens if the config file is invalid.""" |
||
| 20 | 1 | class ConfigTestCase(TestCase): |
|
| 21 | 1 | def testPartialConfig(self): |
|
| 22 | 1 | self.assertRaises(NotImplementedError, PartialConfig) |
|
| 23 | 1 | def testNoConfFile(self): |
|
| 24 | 1 | self.assertRaises(InvalidConfig, Config) |
|
| 25 | |||
| 26 | 1 | def testValidConfig(self): |
|
| 27 | 1 | config_file = tempfile.NamedTemporaryFile('w+') |
|
| 28 | 1 | try: |
|
| 29 | 1 | os.environ['PPP_LIBMODULE_TEST'] = config_file.name |
|
| 30 | 1 | config_file.write('{"foo": "bar"}') |
|
| 31 | 1 | config_file.seek(0) |
|
| 32 | 1 | self.assertEqual(Config().foo, 'bar') |
|
| 33 | finally: |
||
| 34 | 1 | config_file.close() |
|
| 35 | del os.environ['PPP_LIBMODULE_TEST'] |
||
| 36 |