Beispiel #1
0
 def test_image_serve(self):
     handler = notifications.ImageServe()
     counters = handler.process_notification(NOTIFICATION_SEND)
     self.assertEqual(len(counters), 1)
     serve = counters[0]
     self._verify_common_counter(serve, 'image.serve', 42)
     self.assertEqual(serve.project_id, fake_uuid('e'))
     self.assertEquals(serve.resource_metadata.get('receiver_user_id'),
                       fake_uuid('d'))
     self.assertEquals(serve.resource_metadata.get('receiver_tenant_id'),
                       fake_uuid('b'))
     self.assertEqual(serve.type, counter.TYPE_DELTA)
Beispiel #2
0
 def test_image_serve(self):
     handler = notifications.ImageServe(mock.Mock())
     counters = list(handler.process_notification(NOTIFICATION_SEND))
     self.assertEqual(1, len(counters))
     serve = counters[0]
     self._verify_common_counter(serve, 'image.serve', 42)
     self.assertEqual(fake_uuid('e'), serve.project_id)
     self.assertEqual(fake_uuid('d'),
                      serve.resource_metadata.get('receiver_user_id'))
     self.assertEqual(fake_uuid('b'),
                      serve.resource_metadata.get('receiver_tenant_id'))
     self.assertEqual(sample.TYPE_DELTA, serve.type)