| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0d49164 commit d900910
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -32,3 +32,7 @@ Update an existing remote mirror's attributes:: | |||
| 32 | 32 | mirror.enabled = False | |
| 33 | 33 | mirror.only_protected_branches = True | |
| 34 | 34 | mirror.save() | |
| 35 | + | ||
| 36 | + Delete an existing remote mirror:: | ||
| 37 | + | ||
| 38 | + mirror.delete() | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ | |||
| 23 | 23 | from gitlab.mixins import ( | |
| 24 | 24 | CreateMixin, | |
| 25 | 25 | CRUDMixin, | |
| 26 | + DeleteMixin, | ||
| 26 | 27 | GetWithoutIdMixin, | |
| 27 | 28 | ListMixin, | |
| 28 | 29 | ObjectDeleteMixin, | |
@@ -1199,11 +1200,13 @@ def create( | |||
| 1199 | 1200 | return cast(ProjectFork, CreateMixin.create(self, data, path=path, **kwargs)) | |
| 1200 | 1201 | ||
| 1201 | 1202 | ||
| 1202 | - class ProjectRemoteMirror(SaveMixin, RESTObject): | ||
| 1203 | + class ProjectRemoteMirror(ObjectDeleteMixin, SaveMixin, RESTObject): | ||
| 1203 | 1204 | pass | |
| 1204 | 1205 | ||
| 1205 | 1206 | ||
| 1206 | - class ProjectRemoteMirrorManager(ListMixin, CreateMixin, UpdateMixin, RESTManager): | ||
| 1207 | + class ProjectRemoteMirrorManager( | ||
| 1208 | + ListMixin, CreateMixin, UpdateMixin, DeleteMixin, RESTManager | ||
| 1209 | + ): | ||
| 1207 | 1210 | _path = "/projects/{project_id}/remote_mirrors" | |
| 1208 | 1211 | _obj_cls = ProjectRemoteMirror | |
| 1209 | 1212 | _from_parent_attrs = {"project_id": "id"} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -282,6 +282,8 @@ def test_project_remote_mirrors(project): | |||
| 282 | 282 | assert mirror.url == mirror_url | |
| 283 | 283 | assert mirror.enabled is True | |
| 284 | 284 | ||
| 285 | + mirror.delete() | ||
| 286 | + | ||
| 285 | 287 | ||
| 286 | 288 | def test_project_services(project): | |
| 287 | 289 | # Use 'update' to create a service as we don't have a 'create' method and | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,6 +48,12 @@ def resp_remote_mirrors(): | |||
| 48 | 48 | content_type="application/json", | |
| 49 | 49 | status=200, | |
| 50 | 50 | ) | |
| 51 | + | ||
| 52 | + rsps.add( | ||
| 53 | + method=responses.DELETE, | ||
| 54 | + url="http://localhost/api/v4/projects/1/remote_mirrors/1", | ||
| 55 | + status=204, | ||
| 56 | + ) | ||
| 51 | 57 | yield rsps | |
| 52 | 58 | ||
| 53 | 59 | ||
@@ -70,3 +76,8 @@ def test_update_project_remote_mirror(project, resp_remote_mirrors): | |||
| 70 | 76 | mirror.save() | |
| 71 | 77 | assert mirror.update_status == "finished" | |
| 72 | 78 | assert mirror.only_protected_branches | |
| 79 | + | ||
| 80 | + | ||
| 81 | + def test_delete_project_remote_mirror(project, resp_remote_mirrors): | ||
| 82 | + mirror = project.remote_mirrors.create({"url": "https://example.com"}) | ||
| 83 | + mirror.delete() | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments