Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd900910

Browse files
remyj38nejch
authored andcommitted
feat(api): support project remote mirror deletion
1 parent0d49164 commitd900910

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

‎docs/gl_objects/remote_mirrors.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ Update an existing remote mirror's attributes::
3232
mirror.enabled = False
3333
mirror.only_protected_branches = True
3434
mirror.save()
35+
36+
Delete an existing remote mirror::
37+
38+
mirror.delete()

‎gitlab/v4/objects/projects.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
fromgitlab.mixinsimport (
2424
CreateMixin,
2525
CRUDMixin,
26+
DeleteMixin,
2627
GetWithoutIdMixin,
2728
ListMixin,
2829
ObjectDeleteMixin,
@@ -1199,11 +1200,13 @@ def create(
11991200
returncast(ProjectFork,CreateMixin.create(self,data,path=path,**kwargs))
12001201

12011202

1202-
classProjectRemoteMirror(SaveMixin,RESTObject):
1203+
classProjectRemoteMirror(ObjectDeleteMixin,SaveMixin,RESTObject):
12031204
pass
12041205

12051206

1206-
classProjectRemoteMirrorManager(ListMixin,CreateMixin,UpdateMixin,RESTManager):
1207+
classProjectRemoteMirrorManager(
1208+
ListMixin,CreateMixin,UpdateMixin,DeleteMixin,RESTManager
1209+
):
12071210
_path="/projects/{project_id}/remote_mirrors"
12081211
_obj_cls=ProjectRemoteMirror
12091212
_from_parent_attrs= {"project_id":"id"}

‎tests/functional/api/test_projects.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@ def test_project_remote_mirrors(project):
282282
assertmirror.url==mirror_url
283283
assertmirror.enabledisTrue
284284

285+
mirror.delete()
286+
285287

286288
deftest_project_services(project):
287289
# Use 'update' to create a service as we don't have a 'create' method and

‎tests/unit/objects/test_remote_mirrors.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ def resp_remote_mirrors():
4848
content_type="application/json",
4949
status=200,
5050
)
51+
52+
rsps.add(
53+
method=responses.DELETE,
54+
url="http://localhost/api/v4/projects/1/remote_mirrors/1",
55+
status=204,
56+
)
5157
yieldrsps
5258

5359

@@ -70,3 +76,8 @@ def test_update_project_remote_mirror(project, resp_remote_mirrors):
7076
mirror.save()
7177
assertmirror.update_status=="finished"
7278
assertmirror.only_protected_branches
79+
80+
81+
deftest_delete_project_remote_mirror(project,resp_remote_mirrors):
82+
mirror=project.remote_mirrors.create({"url":"https://example.com"})
83+
mirror.delete()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp