diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-05-02 21:15:51 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-05-02 21:15:51 +0000 |
| commit | b9311480dd758ef6c736f116ffbf2ddcd9c00fd0 (patch) | |
| tree | 63881e60db2f9bc6d5c80976073dfdd26a58e2c6 | |
| parent | 367bf710d9da61920f82d97482584195cc88bbce (diff) | |
| parent | 330d4af34f190517b3e40c9abf451dc1bc992fe3 (diff) | |
| download | keystone-b9311480dd758ef6c736f116ffbf2ddcd9c00fd0.tar.gz keystone-b9311480dd758ef6c736f116ffbf2ddcd9c00fd0.tar.xz keystone-b9311480dd758ef6c736f116ffbf2ddcd9c00fd0.zip | |
Merge "Misnamed exception attribute (bug 991936)"
| -rw-r--r-- | keystone/exception.py | 12 | ||||
| -rw-r--r-- | tests/test_exception.py | 18 |
2 files changed, 20 insertions, 10 deletions
diff --git a/keystone/exception.py b/keystone/exception.py index f1651bf0..84f1e79e 100644 --- a/keystone/exception.py +++ b/keystone/exception.py @@ -107,12 +107,6 @@ class Conflict(Error): title = 'Conflict' -class NotImplemented(Error): - """The action you have requested has not been implemented.""" - code = 501 - action = 'Not Implemented' - - class UnexpectedError(Error): """An unexpected error prevented the server from fulfilling your request. @@ -121,3 +115,9 @@ class UnexpectedError(Error): """ code = 500 title = 'Internal Server Error' + + +class NotImplemented(Error): + """The action you have requested has not been implemented.""" + code = 501 + title = 'Not Implemented' diff --git a/tests/test_exception.py b/tests/test_exception.py index a51efff2..c74a60c6 100644 --- a/tests/test_exception.py +++ b/tests/test_exception.py @@ -42,6 +42,20 @@ class ExceptionTestCase(test.TestCase): self.assertNotIn(' ', j['error']['message']) self.assertTrue(type(j['error']['code']) is int) + def test_all_json_renderings(self): + """Everything callable in the exception module should be renderable. + + ... except for the base error class (exception.Error), which is not + user-facing. + + This test provides a custom message to bypass docstring parsing, which + should be tested seperately. + + """ + for cls in [x for x in exception.__dict__.values() if callable(x)]: + if cls is not exception.Error: + self.assertValidJsonRendering(cls(message='Overriden.')) + def test_validation_error(self): target = uuid.uuid4().hex attribute = uuid.uuid4().hex @@ -50,10 +64,6 @@ class ExceptionTestCase(test.TestCase): self.assertIn(target, str(e)) self.assertIn(attribute, str(e)) - def test_unauthorized(self): - e = exception.Unauthorized() - self.assertValidJsonRendering(e) - def test_forbidden_action(self): action = uuid.uuid4().hex e = exception.ForbiddenAction(action=action) |
