diff options
author | Nejc Habjan <hab.nejc@gmail.com> | 2021-12-01 01:04:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-01 01:04:53 +0100 |
commit | 8d76826fa64460e504acc5924f859f8dbc246b42 (patch) | |
tree | 083fefada982c795e2415092794db429abb0c184 /tests/unit/objects/test_remote_mirrors.py | |
parent | 5a1678f43184bd459132102cc13cf8426fe0449d (diff) | |
parent | 86ab04e54ea4175f10053decfad5086cda7aa024 (diff) | |
download | gitlab-master.tar.gz |
Merge pull request #1723 from python-gitlab/jlvillal/dead_mastermaster
Close-out `master` branch
Diffstat (limited to 'tests/unit/objects/test_remote_mirrors.py')
-rw-r--r-- | tests/unit/objects/test_remote_mirrors.py | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/tests/unit/objects/test_remote_mirrors.py b/tests/unit/objects/test_remote_mirrors.py deleted file mode 100644 index 1ac35a2..0000000 --- a/tests/unit/objects/test_remote_mirrors.py +++ /dev/null @@ -1,72 +0,0 @@ -""" -GitLab API: https://docs.gitlab.com/ce/api/remote_mirrors.html -""" - -import pytest -import responses - -from gitlab.v4.objects import ProjectRemoteMirror - - -@pytest.fixture -def resp_remote_mirrors(): - content = { - "enabled": True, - "id": 1, - "last_error": None, - "last_successful_update_at": "2020-01-06T17:32:02.823Z", - "last_update_at": "2020-01-06T17:32:02.823Z", - "last_update_started_at": "2020-01-06T17:31:55.864Z", - "only_protected_branches": True, - "update_status": "none", - "url": "https://*****:*****@gitlab.com/gitlab-org/security/gitlab.git", - } - - with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps: - rsps.add( - method=responses.GET, - url="http://localhost/api/v4/projects/1/remote_mirrors", - json=[content], - content_type="application/json", - status=200, - ) - rsps.add( - method=responses.POST, - url="http://localhost/api/v4/projects/1/remote_mirrors", - json=content, - content_type="application/json", - status=200, - ) - - updated_content = dict(content) - updated_content["update_status"] = "finished" - - rsps.add( - method=responses.PUT, - url="http://localhost/api/v4/projects/1/remote_mirrors/1", - json=updated_content, - content_type="application/json", - status=200, - ) - yield rsps - - -def test_list_project_remote_mirrors(project, resp_remote_mirrors): - mirrors = project.remote_mirrors.list() - assert isinstance(mirrors, list) - assert isinstance(mirrors[0], ProjectRemoteMirror) - assert mirrors[0].enabled - - -def test_create_project_remote_mirror(project, resp_remote_mirrors): - mirror = project.remote_mirrors.create({"url": "https://example.com"}) - assert isinstance(mirror, ProjectRemoteMirror) - assert mirror.update_status == "none" - - -def test_update_project_remote_mirror(project, resp_remote_mirrors): - mirror = project.remote_mirrors.create({"url": "https://example.com"}) - mirror.only_protected_branches = True - mirror.save() - assert mirror.update_status == "finished" - assert mirror.only_protected_branches |