diff --git a/cinder/message/message_field.py b/cinder/message/message_field.py index 87e4f085172..a091988af8b 100644 --- a/cinder/message/message_field.py +++ b/cinder/message/message_field.py @@ -108,7 +108,6 @@ class Detail(object): 'BackupLimitExceeded', 'SnapshotLimitExceeded'], NOT_ENOUGH_SPACE_FOR_IMAGE: ['ImageTooBig'], - UNMANAGE_ENC_NOT_SUPPORTED: ['UnmanageEncVolNotSupported'], } diff --git a/cinder/tests/unit/message/test_message_field.py b/cinder/tests/unit/message/test_message_field.py index f983abbd91d..79fdd050ee9 100644 --- a/cinder/tests/unit/message/test_message_field.py +++ b/cinder/tests/unit/message/test_message_field.py @@ -11,6 +11,8 @@ # under the License. import ddt +import inspect +from itertools import chain from oslo_config import cfg @@ -23,6 +25,30 @@ CONF = cfg.CONF @ddt.ddt class MessageFieldTest(test.TestCase): + def test_unique_action_ids(self): + """Assert that no action_id is duplicated.""" + action_ids = [x[0] for x in message_field.Action.ALL] + self.assertEqual(len(action_ids), len(set(action_ids))) + + def test_unique_detail_ids(self): + """Assert that no detail_id is duplicated.""" + detail_ids = [x[0] for x in message_field.Detail.ALL] + self.assertEqual(len(detail_ids), len(set(detail_ids))) + + known_exceptions = [ + name for name, _ in + inspect.getmembers(exception, inspect.isclass)] + mapped_exceptions = list(chain.from_iterable( + message_field.Detail.EXCEPTION_DETAIL_MAPPINGS.values())) + + @ddt.idata(mapped_exceptions) + def test_exception_detail_map_no_unknown_exceptions(self, exc): + """Assert that only known exceptions are in the map.""" + self.assertIn(exc, self.known_exceptions) + + +@ddt.ddt +class MessageFieldFunctionsTest(test.TestCase): @ddt.data({'id': '001', 'content': 'schedule allocate volume'}, {'id': '002', 'content': 'attach volume'}, diff --git a/lower-constraints.txt b/lower-constraints.txt index 5d22b1b33ae..f497905ced6 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -17,7 +17,7 @@ contextlib2==0.5.5 coverage==4.0 cryptography==2.1 cursive==0.2.1 -ddt==1.0.1 +ddt==1.2.1 debtcollector==1.19.0 decorator==3.4.0 defusedxml==0.5.0 diff --git a/test-requirements.txt b/test-requirements.txt index 31a249abf76..76c0a4db58e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,7 @@ hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 -ddt>=1.0.1 # MIT +ddt>=1.2.1 # MIT fixtures>=3.0.0 # Apache-2.0/BSD mock>=2.0.0 # BSD os-api-ref>=1.4.0 # Apache-2.0