Clean up code to use .items()
The code was overly complicated because it didn't use .items() to get the value along with the key. Change-Id: I4b8b4bb3fbb5854d3e24e40ff110ef45a3b1bff8
This commit is contained in:
parent
1bc64117c1
commit
a70fc983ee
|
@ -332,11 +332,10 @@ def listener(cls):
|
|||
return __new_init__
|
||||
|
||||
def _register_event_callbacks(self):
|
||||
for event in self.event_callbacks:
|
||||
for resource_type in self.event_callbacks[event]:
|
||||
for event, resource_types in self.event_callbacks.items():
|
||||
for resource_type, callbacks in resource_types.items():
|
||||
# Make sure we register the provider for each event it
|
||||
# cares to call back.
|
||||
callbacks = self.event_callbacks[event][resource_type]
|
||||
if not callbacks:
|
||||
continue
|
||||
if not hasattr(callbacks, '__iter__'):
|
||||
|
|
|
@ -716,7 +716,7 @@ class TestEventCallbacks(test_v3.RestfulTestCase):
|
|||
def __init__(self):
|
||||
self.event_callbacks = 'bogus'
|
||||
|
||||
self.assertRaises(TypeError, Foo)
|
||||
self.assertRaises(AttributeError, Foo)
|
||||
|
||||
def test_invalid_event_callbacks_event(self):
|
||||
@notifications.listener
|
||||
|
@ -724,7 +724,7 @@ class TestEventCallbacks(test_v3.RestfulTestCase):
|
|||
def __init__(self):
|
||||
self.event_callbacks = {CREATED_OPERATION: 'bogus'}
|
||||
|
||||
self.assertRaises(TypeError, Foo)
|
||||
self.assertRaises(AttributeError, Foo)
|
||||
|
||||
|
||||
class CadfNotificationsWrapperTestCase(test_v3.RestfulTestCase):
|
||||
|
|
Loading…
Reference in New Issue