From 888f3328d3b1c82a291efbdd9eb01f11dff0c764 Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 13 Jan 2022 07:39:39 -0800 Subject: [PATCH] fix(api): services: add missing `lazy` parameter Commit 8da0b758c589f608a6ae4eeb74b3f306609ba36d added the `lazy` parameter to the services `get()` method but missed then using the `lazy` parameter when it called `super(...).get(...)` Closes: #1828 --- gitlab/v4/objects/services.py | 10 +++++++++- tests/functional/api/test_services.py | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 tests/functional/api/test_services.py diff --git a/gitlab/v4/objects/services.py b/gitlab/v4/objects/services.py index 632f002aa..2af04d24a 100644 --- a/gitlab/v4/objects/services.py +++ b/gitlab/v4/objects/services.py @@ -1,3 +1,8 @@ +""" +GitLab API: +https://docs.gitlab.com/ee/api/integrations.html +""" + from typing import Any, cast, Dict, List, Optional, Union from gitlab import cli @@ -275,7 +280,10 @@ def get( GitlabAuthenticationError: If authentication is not correct GitlabGetError: If the server cannot perform the request """ - obj = cast(ProjectService, super(ProjectServiceManager, self).get(id, **kwargs)) + obj = cast( + ProjectService, + super(ProjectServiceManager, self).get(id, lazy=lazy, **kwargs), + ) obj.id = id return obj diff --git a/tests/functional/api/test_services.py b/tests/functional/api/test_services.py new file mode 100644 index 000000000..100c0c9e5 --- /dev/null +++ b/tests/functional/api/test_services.py @@ -0,0 +1,11 @@ +""" +GitLab API: +https://docs.gitlab.com/ee/api/integrations.html +""" + +import gitlab + + +def test_services(project): + service = project.services.get("jira", lazy=True) + assert isinstance(service, gitlab.v4.objects.ProjectService)