Skip to content

Commit 905781b

Browse files
lgatellierLéo GATELLIER
andauthored
fix(api): delete invalid 'project-runner get' command (#1628)
* fix(api): delete 'group-runner get' and 'group-runner delete' commands Co-authored-by: Léo GATELLIER <git@leogatellier.fr>
1 parent 4170dbe commit 905781b

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

gitlab/v4/objects/runners.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
from gitlab import types
44
from gitlab.base import RequiredOptional, RESTManager, RESTObject
55
from gitlab.mixins import (
6+
CreateMixin,
67
CRUDMixin,
8+
DeleteMixin,
79
ListMixin,
8-
NoUpdateMixin,
910
ObjectDeleteMixin,
1011
SaveMixin,
1112
)
@@ -114,11 +115,11 @@ def verify(self, token, **kwargs):
114115
self.gitlab.http_post(path, post_data=post_data, **kwargs)
115116

116117

117-
class GroupRunner(ObjectDeleteMixin, RESTObject):
118+
class GroupRunner(RESTObject):
118119
pass
119120

120121

121-
class GroupRunnerManager(NoUpdateMixin, RESTManager):
122+
class GroupRunnerManager(ListMixin, RESTManager):
122123
_path = "/groups/%(group_id)s/runners"
123124
_obj_cls = GroupRunner
124125
_from_parent_attrs = {"group_id": "id"}
@@ -131,7 +132,7 @@ class ProjectRunner(ObjectDeleteMixin, RESTObject):
131132
pass
132133

133134

134-
class ProjectRunnerManager(NoUpdateMixin, RESTManager):
135+
class ProjectRunnerManager(CreateMixin, DeleteMixin, ListMixin, RESTManager):
135136
_path = "/projects/%(project_id)s/runners"
136137
_obj_cls = ProjectRunner
137138
_from_parent_attrs = {"project_id": "id"}

tests/unit/objects/test_runners.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def resp_runner_register():
143143
@pytest.fixture
144144
def resp_runner_enable():
145145
with responses.RequestsMock() as rsps:
146-
pattern = re.compile(r".*?(projects|groups)/1/runners")
146+
pattern = re.compile(r".*?projects/1/runners")
147147
rsps.add(
148148
method=responses.POST,
149149
url=pattern,
@@ -176,7 +176,7 @@ def resp_runner_delete():
176176
@pytest.fixture
177177
def resp_runner_disable():
178178
with responses.RequestsMock() as rsps:
179-
pattern = re.compile(r".*?/(groups|projects)/1/runners/6")
179+
pattern = re.compile(r".*?/projects/1/runners/6")
180180
rsps.add(
181181
method=responses.DELETE,
182182
url=pattern,
@@ -252,24 +252,13 @@ def test_disable_project_runner(gl: gitlab.Gitlab, resp_runner_disable):
252252
gl.projects.get(1, lazy=True).runners.delete(6)
253253

254254

255-
def test_disable_group_runner(gl: gitlab.Gitlab, resp_runner_disable):
256-
gl.groups.get(1, lazy=True).runners.delete(6)
257-
258-
259255
def test_enable_project_runner(gl: gitlab.Gitlab, resp_runner_enable):
260256
runner = gl.projects.get(1, lazy=True).runners.create({"runner_id": 6})
261257
assert runner.active is True
262258
assert runner.id == 6
263259
assert runner.name == "test-name"
264260

265261

266-
def test_enable_group_runner(gl: gitlab.Gitlab, resp_runner_enable):
267-
runner = gl.groups.get(1, lazy=True).runners.create({"runner_id": 6})
268-
assert runner.active is True
269-
assert runner.id == 6
270-
assert runner.name == "test-name"
271-
272-
273262
def test_verify_runner(gl: gitlab.Gitlab, resp_runner_verify):
274263
gl.runners.verify("token")
275264

0 commit comments

Comments
 (0)