예제 #1
0
 def test_notification_after_serialization(self, notifier):
     orig_notify = notification.TroveBaseTraits(instance=self.instance)
     serialized = orig_notify.serialize(None)
     new_notify = notification.TroveBaseTraits().deserialize(None,
                                                             serialized)
     new_notify.notify('event_type', 'publisher')
     self.assertTrue(notifier().info.called)
예제 #2
0
 def test_n(self, notifier):
     notification.TroveBaseTraits(
         instance=self.instance).notify('event_type', 'publisher')
     self.assertTrue(notifier().info.called)
     a, _ = notifier().info.call_args
     payload = a[2]
     required_payload_keys = [
         'created_at', 'name', 'instance_id', 'instance_name',
         'instance_type_id', 'launched_at', 'nova_instance_id', 'region',
         'state_description', 'state', 'tenant_id', 'user_id'
     ]
     self.assertTrue(set(required_payload_keys).issubset(set(payload)))