diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2014-12-08 13:12:53 +1000 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2015-02-02 09:23:39 +1100 |
| commit | c57e562d2b941c47abdfea46fbe45e8f8cdf431b (patch) | |
| tree | 903f510c166dcc530aed452ef50ec008ac0bde92 /keystoneclient/tests | |
| parent | bf99f4c1efd8b79d6a8b77c774f761f7ec755c52 (diff) | |
| download | python-keystoneclient-c57e562d2b941c47abdfea46fbe45e8f8cdf431b.tar.gz | |
Add name parameter to NoMatchingPlugin exception
If you want to handle a NoMatchingPlugin exception rather than simply
exit then the name of the missing plugin is generally more useful than
the message.
The exception is specific enough that you can know what went wrong, but
you cannot determine the name of the missing plugin if you want to do
your own logging - only use the message that is generated.
We should keep the message but expose the plugin name as well.
Closes-Bug: #1410391
Change-Id: Ic93ec6583b8d7797529d36d63995ef0d8db754f1
Diffstat (limited to 'keystoneclient/tests')
| -rw-r--r-- | keystoneclient/tests/auth/test_conf.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/keystoneclient/tests/auth/test_conf.py b/keystoneclient/tests/auth/test_conf.py index 342333f..4945b3f 100644 --- a/keystoneclient/tests/auth/test_conf.py +++ b/keystoneclient/tests/auth/test_conf.py @@ -92,13 +92,16 @@ class ConfTests(utils.TestCase): self.assertEqual(project_domain_name, a.project_domain_name) def test_loading_invalid_plugin(self): - self.conf_fixture.config(auth_plugin=uuid.uuid4().hex, + auth_plugin = uuid.uuid4().hex + self.conf_fixture.config(auth_plugin=auth_plugin, group=self.GROUP) - self.assertRaises(exceptions.NoMatchingPlugin, - conf.load_from_conf_options, - self.conf_fixture.conf, - self.GROUP) + e = self.assertRaises(exceptions.NoMatchingPlugin, + conf.load_from_conf_options, + self.conf_fixture.conf, + self.GROUP) + + self.assertEqual(auth_plugin, e.name) def test_loading_with_no_data(self): self.assertIsNone(conf.load_from_conf_options(self.conf_fixture.conf, |
