diff --git a/gitlab/v4/objects/runners.py b/gitlab/v4/objects/runners.py index a32dc8493..ec8153f4d 100644 --- a/gitlab/v4/objects/runners.py +++ b/gitlab/v4/objects/runners.py @@ -3,9 +3,10 @@ from gitlab import types from gitlab.base import RequiredOptional, RESTManager, RESTObject from gitlab.mixins import ( + CreateMixin, CRUDMixin, + DeleteMixin, ListMixin, - NoUpdateMixin, ObjectDeleteMixin, SaveMixin, ) @@ -114,11 +115,11 @@ def verify(self, token, **kwargs): self.gitlab.http_post(path, post_data=post_data, **kwargs) -class GroupRunner(ObjectDeleteMixin, RESTObject): +class GroupRunner(RESTObject): pass -class GroupRunnerManager(NoUpdateMixin, RESTManager): +class GroupRunnerManager(ListMixin, RESTManager): _path = "/groups/%(group_id)s/runners" _obj_cls = GroupRunner _from_parent_attrs = {"group_id": "id"} @@ -131,7 +132,7 @@ class ProjectRunner(ObjectDeleteMixin, RESTObject): pass -class ProjectRunnerManager(NoUpdateMixin, RESTManager): +class ProjectRunnerManager(CreateMixin, DeleteMixin, ListMixin, RESTManager): _path = "/projects/%(project_id)s/runners" _obj_cls = ProjectRunner _from_parent_attrs = {"project_id": "id"} diff --git a/tests/unit/objects/test_runners.py b/tests/unit/objects/test_runners.py index c54ecdf59..1f3dc481f 100644 --- a/tests/unit/objects/test_runners.py +++ b/tests/unit/objects/test_runners.py @@ -143,7 +143,7 @@ def resp_runner_register(): @pytest.fixture def resp_runner_enable(): with responses.RequestsMock() as rsps: - pattern = re.compile(r".*?(projects|groups)/1/runners") + pattern = re.compile(r".*?projects/1/runners") rsps.add( method=responses.POST, url=pattern, @@ -176,7 +176,7 @@ def resp_runner_delete(): @pytest.fixture def resp_runner_disable(): with responses.RequestsMock() as rsps: - pattern = re.compile(r".*?/(groups|projects)/1/runners/6") + pattern = re.compile(r".*?/projects/1/runners/6") rsps.add( method=responses.DELETE, url=pattern, @@ -252,10 +252,6 @@ def test_disable_project_runner(gl: gitlab.Gitlab, resp_runner_disable): gl.projects.get(1, lazy=True).runners.delete(6) -def test_disable_group_runner(gl: gitlab.Gitlab, resp_runner_disable): - gl.groups.get(1, lazy=True).runners.delete(6) - - def test_enable_project_runner(gl: gitlab.Gitlab, resp_runner_enable): runner = gl.projects.get(1, lazy=True).runners.create({"runner_id": 6}) assert runner.active is True @@ -263,13 +259,6 @@ def test_enable_project_runner(gl: gitlab.Gitlab, resp_runner_enable): assert runner.name == "test-name" -def test_enable_group_runner(gl: gitlab.Gitlab, resp_runner_enable): - runner = gl.groups.get(1, lazy=True).runners.create({"runner_id": 6}) - assert runner.active is True - assert runner.id == 6 - assert runner.name == "test-name" - - def test_verify_runner(gl: gitlab.Gitlab, resp_runner_verify): gl.runners.verify("token")