From 4ee139ad5c58006da1f9af93fdd4e70592e6daa0 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sat, 11 Nov 2017 16:06:21 +0100 Subject: Add unit tests for mixin exceptions --- gitlab/mixins.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'gitlab/mixins.py') diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 3d6e321..c9243ed 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -113,7 +113,12 @@ class GetFromListMixin(ListMixin): GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server cannot perform the request """ - gen = self.list() + try: + gen = self.list() + except exc.GitlabListError: + raise exc.GitlabGetError(response_code=404, + error_message="Not found") + for obj in gen: if str(obj.get_id()) == str(id): return obj @@ -382,7 +387,7 @@ class SubscribableMixin(object): class TodoMixin(object): @cli.register_custom_action(('ProjectIssue', 'ProjectMergeRequest')) - @exc.on_http_error(exc.GitlabHttpError) + @exc.on_http_error(exc.GitlabTodoError) def todo(self, **kwargs): """Create a todo associated to the object. -- cgit v1.2.1