def test_get_list(self): timeutils.set_time_override() self.mox.StubOutWithMock(db, 'actions_get') actions = [dict(fake_action, id=1234), dict(fake_action, id=5678)] db.actions_get(self.context, 'fake-uuid').AndReturn(actions) self.mox.ReplayAll() action_list = instance_action.InstanceActionList.get_by_instance_uuid( self.context, 'fake-uuid') self.assertEqual(2, len(action_list)) for index, action in enumerate(action_list): self.assertEqual(actions[index]['id'], action.id)
def index(self, req, server_id): """Returns the list of actions recorded for a given instance.""" context = req.environ["nova.context"] instance = self.compute_api.get(context, server_id) authorize_actions(context, target=instance) actions_raw = db.actions_get(context, server_id) actions = [self._format_action(action) for action in actions_raw] return {'instanceActions': actions}
def get_by_instance_uuid(cls, context, instance_uuid, limit=None, marker=None, filters=None): db_actions = db.actions_get(context, instance_uuid, limit, marker, filters) return base.obj_make_list(context, cls(), InstanceAction, db_actions)
def get_by_instance_uuid(cls, context, instance_uuid): db_actions = db.actions_get(context, instance_uuid) return base.obj_make_list(context, cls(), InstanceAction, db_actions)