diff options
author | Ryan Moore <ryan.moore@hp.com> | 2014-10-08 13:19:43 +0100 |
---|---|---|
committer | Ryan Moore <ryan.moore@hp.com> | 2014-10-08 13:33:16 +0100 |
commit | 41770ad47f263bc88f380f009e8ab2d8c4de150d (patch) | |
tree | d61f248f9bd58d7685618defa2b1f581b13a3dfb /tests/test_cfg.py | |
parent | 5ada83306c3f4bb8a5acd742313dc70c3fb9a7a4 (diff) | |
download | oslo-config-41770ad47f263bc88f380f009e8ab2d8c4de150d.tar.gz |
Report permission denied when parsing config
Previously was returning ConfigFilesNotFoundError, when
underlying error was 13 - Permission Denied
Change-Id: I2c418f023c510205aa12a3acb9b09e6b1681f0d4
Closes-Bug: #1071799
Diffstat (limited to 'tests/test_cfg.py')
-rw-r--r-- | tests/test_cfg.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_cfg.py b/tests/test_cfg.py index dab7542..96060e7 100644 --- a/tests/test_cfg.py +++ b/tests/test_cfg.py @@ -72,7 +72,11 @@ class ExceptionsTestCase(base.BaseTestCase): def test_config_files_not_found_error(self): msg = str(cfg.ConfigFilesNotFoundError(['foo', 'bar'])) - self.assertEqual(msg, 'Failed to read some config files: foo,bar') + self.assertEqual(msg, 'Failed to find some config files: foo,bar') + + def test_config_files_permission_denied_error(self): + msg = str(cfg.ConfigFilesPermissionDeniedError(['foo', 'bar'])) + self.assertEqual(msg, 'Failed to open some config files: foo,bar') def test_config_dir_not_found_error(self): msg = str(cfg.ConfigDirNotFoundError('foobar')) @@ -2705,6 +2709,15 @@ class SadPathTestCase(BaseTestCase): self.assertRaises(cfg.ConfigFilesNotFoundError, self.conf, ['--config-file', path]) + def test_conf_file_permission_denied(self): + (fd, path) = tempfile.mkstemp() + + os.chmod(path, 0x000) + + self.assertRaises(cfg.ConfigFilesPermissionDeniedError, + self.conf, ['--config-file', path]) + os.remove(path) + def test_conf_file_broken(self): paths = self.create_tempfiles([('test', 'foo')]) |