| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 12aea32 commit 060cfe1
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -250,6 +250,10 @@ Start the pull mirroring process (EE edition):: | |||
| 250 | 250 | ||
| 251 | 251 | project.mirror_pull() | |
| 252 | 252 | ||
| 253 | + Get a project’s pull mirror details (EE edition):: | ||
| 254 | + | ||
| 255 | + mirror_pull_details = project.mirror_pull_details() | ||
| 256 | + | ||
| 253 | 257 | Import / Export | |
| 254 | 258 | =============== | |
| 255 | 259 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -579,6 +579,29 @@ def mirror_pull(self, **kwargs: Any) -> None: | |||
| 579 | 579 | path = f"/projects/{self.encoded_id}/mirror/pull" | |
| 580 | 580 | self.manager.gitlab.http_post(path, **kwargs) | |
| 581 | 581 | ||
| 582 | + @cli.register_custom_action("Project") | ||
| 583 | + @exc.on_http_error(exc.GitlabGetError) | ||
| 584 | + def mirror_pull_details(self, **kwargs: Any) -> Dict[str, Any]: | ||
| 585 | + """Get a project's pull mirror details. | ||
| 586 | + | ||
| 587 | + Introduced in GitLab 15.5. | ||
| 588 | + | ||
| 589 | + Args: | ||
| 590 | + **kwargs: Extra options to send to the server (e.g. sudo) | ||
| 591 | + | ||
| 592 | + Raises: | ||
| 593 | + GitlabAuthenticationError: If authentication is not correct | ||
| 594 | + GitlabGetError: If the server failed to perform the request | ||
| 595 | + | ||
| 596 | + Returns: | ||
| 597 | + dict of the parsed json returned by the server | ||
| 598 | + """ | ||
| 599 | + path = f"/projects/{self.encoded_id}/mirror/pull" | ||
| 600 | + result = self.manager.gitlab.http_get(path, **kwargs) | ||
| 601 | + if TYPE_CHECKING: | ||
| 602 | + assert isinstance(result, dict) | ||
| 603 | + return result | ||
| 604 | + | ||
| 582 | 605 | @cli.register_custom_action("Project", ("to_namespace",)) | |
| 583 | 606 | @exc.on_http_error(exc.GitlabTransferProjectError) | |
| 584 | 607 | def transfer(self, to_namespace: Union[int, str], **kwargs: Any) -> None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -530,6 +530,27 @@ def resp_start_pull_mirroring_project(): | |||
| 530 | 530 | yield rsps | |
| 531 | 531 | ||
| 532 | 532 | ||
| 533 | + @pytest.fixture | ||
| 534 | + def resp_pull_mirror_details_project(): | ||
| 535 | + with responses.RequestsMock() as rsps: | ||
| 536 | + rsps.add( | ||
| 537 | + method=responses.GET, | ||
| 538 | + url="http://localhost/api/v4/projects/1/mirror/pull", | ||
| 539 | + json={ | ||
| 540 | + "id": 101486, | ||
| 541 | + "last_error": None, | ||
| 542 | + "last_successful_update_at": "2020-01-06T17:32:02.823Z", | ||
| 543 | + "last_update_at": "2020-01-06T17:32:02.823Z", | ||
| 544 | + "last_update_started_at": "2020-01-06T17:31:55.864Z", | ||
| 545 | + "update_status": "finished", | ||
| 546 | + "url": "https://*****:*****@gitlab.com/gitlab-org/security/gitlab.git", | ||
| 547 | + }, | ||
| 548 | + content_type="application/json", | ||
| 549 | + status=200, | ||
| 550 | + ) | ||
| 551 | + yield rsps | ||
| 552 | + | ||
| 553 | + | ||
| 533 | 554 | @pytest.fixture | |
| 534 | 555 | def resp_snapshot_project(): | |
| 535 | 556 | with responses.RequestsMock() as rsps: | |
@@ -766,6 +787,12 @@ def test_project_pull_mirror(project, resp_start_pull_mirroring_project): | |||
| 766 | 787 | project.mirror_pull() | |
| 767 | 788 | ||
| 768 | 789 | ||
| 790 | + def test_project_pull_mirror_details(project, resp_pull_mirror_details_project): | ||
| 791 | + details = project.mirror_pull_details() | ||
| 792 | + assert details["last_error"] is None | ||
| 793 | + assert details["update_status"] == "finished" | ||
| 794 | + | ||
| 795 | + | ||
| 769 | 796 | def test_project_restore(project, resp_restore_project): | |
| 770 | 797 | project.restore() | |
| 771 | 798 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments