def save_delete(self, raw): values = { 'uuid': self.uuid, 'raw': raw, 'deleted_at': self.deleted_at } db.create_image_delete(**values)
def test_save_delete_should_persist_image_delete(self): raw = self.mox.CreateMockAnything() uuid = "2df2ccf6-bc1b-4853-aab0-25fda346b3bb" deleted_at = "2013-06-20 14:31:57.939614" body = { "event_type": "image.delete", "publisher_id": "glance-api01-r2961.global.preprod-ord.ohthree.com", "payload": { "id": "2df2ccf6-bc1b-4853-aab0-25fda346b3bb", "deleted_at": deleted_at } } deployment = "1" routing_key = "glance_monitor.info" json = '{["routing_key", {%s}]}' % body self.mox.StubOutWithMock(db, 'create_image_delete') db.create_image_delete( raw=raw, uuid=uuid, deleted_at=utils.str_time_to_unix(deleted_at)).AndReturn(raw) self.mox.ReplayAll() notification = GlanceNotification(body, deployment, routing_key, json) notification.save_delete(raw) self.mox.VerifyAll()
def test_save_delete_should_persist_image_delete(self): raw = self.mox.CreateMockAnything() uuid = "2df2ccf6-bc1b-4853-aab0-25fda346b3bb" deleted_at = "2013-06-20 14:31:57.939614" body = { "event_type": "image.delete", "publisher_id": "glance-api01-r2961.global.preprod-ord.ohthree.com", "payload": { "id": "2df2ccf6-bc1b-4853-aab0-25fda346b3bb", "deleted_at": deleted_at } } deployment = "1" routing_key = "glance_monitor.info" json_body = json.dumps([routing_key, body]) self.mox.StubOutWithMock(db, 'create_image_delete') db.create_image_delete( raw=raw, uuid=uuid, deleted_at=utils.str_time_to_unix(deleted_at)).AndReturn(raw) self.mox.ReplayAll() notification = GlanceNotification(body, deployment, routing_key, json_body) notification.save_delete(raw) self.mox.VerifyAll()
def save_delete(self, raw): values = {'uuid': self.uuid, 'raw': raw, 'deleted_at': self.deleted_at} db.create_image_delete(**values)