From 34605fccb972afd6162f8dfd68ecab1a29a73512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= Date: Mon, 26 Apr 2021 15:48:47 +0200 Subject: [PATCH 1/4] Use GitlabGetError from gitlab.exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Imports from other 'gitlab' modules might work, if they in turn import the exception, but things will stop working as soon as this stops being true :D Fixes #573. Signed-off-by: Hunor Csomortáni --- ogr/services/gitlab/project.py | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/ogr/services/gitlab/project.py b/ogr/services/gitlab/project.py index 4bd1f7f9..b8699c0a 100644 --- a/ogr/services/gitlab/project.py +++ b/ogr/services/gitlab/project.py @@ -1,30 +1,11 @@ -# MIT License -# -# Copyright (c) 2018-2019 Red Hat, Inc. - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. +# Copyright Contributors to the Packit project. +# SPDX-License-Identifier: MIT import logging from typing import List, Optional, Dict, Set, Union import gitlab -from gitlab.v4.objects import GitlabGetError, Project as GitlabObjectsProject +from gitlab.v4.objects import Project as GitlabObjectsProject from ogr.abstract import ( PullRequest, @@ -128,7 +109,7 @@ def exists(self) -> bool: try: _ = self.gitlab_repo return True - except GitlabGetError as ex: + except gitlab.exceptions.GitlabGetError as ex: if "404 Project Not Found" in str(ex): return False raise GitlabAPIException from ex From 31b86ad402a1e129ee9bd91e45159491b700910e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= Date: Tue, 27 Apr 2021 09:35:09 +0200 Subject: [PATCH 2/4] Update cassette for GitLab's PR merge test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Hunor Csomortáni --- .../PullRequests.test_pr_merge.yaml | 665 ++++++++++++++ ...l_requests.PullRequests.test_pr_merge.yaml | 866 ------------------ .../integration/gitlab/test_pull_requests.py | 9 +- 3 files changed, 673 insertions(+), 867 deletions(-) create mode 100644 tests/integration/gitlab/test_data/test_pull_requests/PullRequests.test_pr_merge.yaml delete mode 100644 tests/integration/gitlab/test_data/test_pull_requests/tests.integration.gitlab.test_pull_requests.PullRequests.test_pr_merge.yaml diff --git a/tests/integration/gitlab/test_data/test_pull_requests/PullRequests.test_pr_merge.yaml b/tests/integration/gitlab/test_data/test_pull_requests/PullRequests.test_pr_merge.yaml new file mode 100644 index 00000000..2449c4c8 --- /dev/null +++ b/tests/integration/gitlab/test_data/test_pull_requests/PullRequests.test_pr_merge.yaml @@ -0,0 +1,665 @@ +_requre: + DataTypes: 1 + key_strategy: StorageKeysInspectSimple + version_storage_file: 3 +requests.sessions: + send: + GET: + https://gitlab.com/api/v4/projects/14233409/merge_requests/71: + - metadata: + latency: 0.29999732971191406 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_pull_requests + - ogr.services.gitlab.project + - ogr.services.gitlab.pull_request + - gitlab.exceptions + - gitlab.mixins + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + allow_collaboration: true + allow_maintainer_to_push: true + approvals_before_merge: null + assignee: null + assignees: [] + author: + avatar_url: https://secure.gravatar.com/avatar/96d32a99efb796de3669943fcf6e5bbb?s=80&d=identicon + id: 551273 + name: csomh + state: active + username: csomh + web_url: https://gitlab.com/csomh + blocking_discussions_resolved: true + changes_count: '1' + closed_at: null + closed_by: null + created_at: '2021-04-27T07:13:34.828Z' + description: "Signed-off-by: Hunor Csomort\xE1ni " + diff_refs: + base_sha: b8e18207cfdad954f1b3a96db34d0706b272e6cf + head_sha: 5dd0a9a1f5b9d3bf820e8849c4be7aafcbe9a8c7 + start_sha: b8e18207cfdad954f1b3a96db34d0706b272e6cf + discussion_locked: null + downvotes: 0 + first_contribution: false + first_deployed_to_production_at: null + force_remove_source_branch: true + has_conflicts: false + head_pipeline: null + id: 97512283 + iid: 71 + labels: [] + latest_build_finished_at: null + latest_build_started_at: null + merge_commit_sha: null + merge_error: null + merge_status: can_be_merged + merge_when_pipeline_succeeds: false + merged_at: null + merged_by: null + milestone: null + pipeline: null + project_id: 14233409 + reference: '!71' + references: + full: packit-service/ogr-tests!71 + relative: '!71' + short: '!71' + reviewers: [] + sha: 5dd0a9a1f5b9d3bf820e8849c4be7aafcbe9a8c7 + should_remove_source_branch: null + source_branch: test-mr-merge + source_project_id: 26200368 + squash: false + squash_commit_sha: null + state: opened + subscribed: true + target_branch: master + target_project_id: 14233409 + task_completion_status: + completed_count: 0 + count: 0 + time_stats: + human_time_estimate: null + human_total_time_spent: null + time_estimate: 0 + total_time_spent: 0 + title: Comit to test merging MRs + updated_at: '2021-04-27T07:13:34.828Z' + upvotes: 0 + user: + can_merge: true + user_notes_count: 0 + web_url: https://gitlab.com/packit-service/ogr-tests/-/merge_requests/71 + work_in_progress: false + _next: null + elapsed: 0.299335 + encoding: utf-8 + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6466471ece2c413e-PRG + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Tue, 27 Apr 2021 07:18:36 GMT + Etag: W/"624d44b1e39567f67e5b65cba8364af7" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-02-lb-gprd + GitLab-SV: localhost + RateLimit-Limit: '2000' + RateLimit-Observed: '2' + RateLimit-Remaining: '1998' + RateLimit-Reset: '1619507976' + RateLimit-ResetTime: Tue, 27 Apr 2021 07:19:36 GMT + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Accept-Encoding, Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: code_review + X-Request-Id: 01F4933BWW9B9K4SA8VC7ZX84X + X-Runtime: '0.075926' + cf-request-id: 09b3cac73d0000413e05156000000001 + raw: !!binary "" + reason: OK + status_code: 200 + https://gitlab.com/api/v4/projects/packit-service%2Fogr-tests: + - metadata: + latency: 0.29019665718078613 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_pull_requests + - ogr.services.gitlab.project + - ogr.services.gitlab.pull_request + - ogr.services.gitlab.project + - gitlab.exceptions + - gitlab.mixins + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + _links: + events: https://gitlab.com/api/v4/projects/14233409/events + issues: https://gitlab.com/api/v4/projects/14233409/issues + labels: https://gitlab.com/api/v4/projects/14233409/labels + members: https://gitlab.com/api/v4/projects/14233409/members + merge_requests: https://gitlab.com/api/v4/projects/14233409/merge_requests + repo_branches: https://gitlab.com/api/v4/projects/14233409/repository/branches + self: https://gitlab.com/api/v4/projects/14233409 + allow_merge_on_skipped_pipeline: null + analytics_access_level: enabled + approvals_before_merge: 0 + archived: false + auto_cancel_pending_pipelines: enabled + auto_devops_deploy_strategy: continuous + auto_devops_enabled: false + autoclose_referenced_issues: true + avatar_url: null + build_coverage_regex: null + build_git_strategy: fetch + build_timeout: 3600 + builds_access_level: enabled + can_create_merge_request_in: true + ci_config_path: null + ci_default_git_depth: 50 + ci_forward_deployment_enabled: null + compliance_frameworks: [] + container_registry_enabled: true + container_registry_image_prefix: registry.gitlab.com/packit-service/ogr-tests + created_at: '2019-09-10T10:28:09.946Z' + creator_id: 433670 + default_branch: master + description: Testing repository for python-ogr package. | https://github.com/packit-service/ogr + emails_disabled: null + empty_repo: false + external_authorization_classification_label: '' + forking_access_level: enabled + forks_count: 6 + http_url_to_repo: https://gitlab.com/packit-service/ogr-tests.git + id: 14233409 + import_error: null + import_status: none + issues_access_level: enabled + issues_enabled: true + issues_template: null + jobs_enabled: true + last_activity_at: '2021-04-27T07:13:35.566Z' + lfs_enabled: true + marked_for_deletion_at: null + marked_for_deletion_on: null + merge_method: merge + merge_requests_access_level: enabled + merge_requests_enabled: true + merge_requests_template: null + mirror: false + name: ogr-tests + name_with_namespace: packit-service / ogr-tests + namespace: + avatar_url: /uploads/-/system/group/avatar/6032704/logo-square-small-borders.png + full_path: packit-service + id: 6032704 + kind: group + name: packit-service + parent_id: null + path: packit-service + web_url: https://gitlab.com/groups/packit-service + only_allow_merge_if_all_discussions_are_resolved: false + only_allow_merge_if_pipeline_succeeds: false + open_issues_count: 68 + operations_access_level: enabled + packages_enabled: true + pages_access_level: enabled + path: ogr-tests + path_with_namespace: packit-service/ogr-tests + permissions: + group_access: + access_level: 50 + notification_level: 3 + project_access: null + printing_merge_request_link_enabled: true + public_jobs: true + readme_url: https://gitlab.com/packit-service/ogr-tests/-/blob/master/README.md + remove_source_branch_after_merge: null + repository_access_level: enabled + request_access_enabled: false + requirements_enabled: true + resolve_outdated_diff_discussions: false + restrict_user_defined_variables: false + runners_token: VjGdzzwZbsTY37sxUeWL + security_and_compliance_enabled: true + service_desk_address: incoming+packit-service-ogr-tests-14233409-issue-@incoming.gitlab.com + service_desk_enabled: true + shared_runners_enabled: true + shared_with_groups: [] + snippets_access_level: enabled + snippets_enabled: true + ssh_url_to_repo: git@gitlab.com:packit-service/ogr-tests.git + star_count: 0 + suggestion_commit_message: null + tag_list: [] + visibility: public + web_url: https://gitlab.com/packit-service/ogr-tests + wiki_access_level: enabled + wiki_enabled: true + _next: null + elapsed: 0.289599 + encoding: utf-8 + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6466471cebb8413e-PRG + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Tue, 27 Apr 2021 07:18:36 GMT + Etag: W/"b21676b679d25085342f53ee37110c03" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-01-lb-gprd + GitLab-SV: localhost + RateLimit-Limit: '2000' + RateLimit-Observed: '2' + RateLimit-Remaining: '1998' + RateLimit-Reset: '1619507976' + RateLimit-ResetTime: Tue, 27 Apr 2021 07:19:36 GMT + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Accept-Encoding, Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: projects + X-Request-Id: 01F4933BKFXEJHETBYKBGHSMAB + X-Runtime: '0.099050' + cf-request-id: 09b3cac6160000413eeea52000000001 + raw: !!binary "" + reason: OK + status_code: 200 + https://gitlab.com/api/v4/user: + - metadata: + latency: 0.2593345642089844 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_pull_requests + - ogr.services.gitlab.project + - ogr.services.gitlab.pull_request + - ogr.services.gitlab.project + - ogr.services.gitlab.service + - gitlab.client + - gitlab.exceptions + - gitlab.mixins + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + avatar_url: https://secure.gravatar.com/avatar/96d32a99efb796de3669943fcf6e5bbb?s=80&d=identicon + bio: '' + bio_html: '' + bot: false + can_create_group: true + can_create_project: true + color_scheme_id: 5 + commit_email: csomortani.hunor@gmail.com + confirmed_at: '2016-05-24T14:41:34.963Z' + created_at: '2016-05-24T14:40:08.336Z' + current_sign_in_at: '2021-04-13T10:56:38.680Z' + email: csomortani.hunor@gmail.com + external: false + extra_shared_runners_minutes_limit: null + followers: 0 + following: 0 + id: 551273 + identities: + - extern_uid: 784760b0-0d75-11e7-80dc-28d244ea5a6d + provider: group_saml + saml_provider_id: 1769 + - extern_uid: '11816497' + provider: github + saml_provider_id: null + - extern_uid: '108390173747341485480' + provider: google_oauth2 + saml_provider_id: null + job_title: '' + last_activity_on: '2021-04-27' + last_sign_in_at: '2021-03-31T16:17:19.318Z' + linkedin: '' + location: '' + name: csomh + organization: '' + private_profile: false + projects_limit: 100000 + public_email: '' + shared_runners_minutes_limit: 2000 + skype: '' + state: active + theme_id: 2 + twitter: '' + two_factor_enabled: true + username: csomh + web_url: https://gitlab.com/csomh + website_url: '' + work_information: null + _next: null + elapsed: 0.258448 + encoding: utf-8 + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6466471b6981413e-PRG + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Tue, 27 Apr 2021 07:18:36 GMT + Etag: W/"4e0db1d66a6e393facd54bfc135cb434" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-12-lb-gprd + GitLab-SV: localhost + RateLimit-Limit: '2000' + RateLimit-Observed: '1' + RateLimit-Remaining: '1999' + RateLimit-Reset: '1619507976' + RateLimit-ResetTime: Tue, 27 Apr 2021 07:19:36 GMT + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Set-Cookie: __cfduid=d8b203f6f798115c3c8e9dbfde13aa1931619507916; expires=Thu, + 27-May-21 07:18:36 GMT; path=/; domain=.gitlab.com; HttpOnly; SameSite=Lax; + Secure + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Accept-Encoding, Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: users + X-Request-Id: 01F4933BBYD73VA8TK3PTZQ60P + X-Runtime: '0.040038' + cf-request-id: 09b3cac5240000413e750c8000000001 + raw: !!binary "" + reason: OK + status_code: 200 + PUT: + https://gitlab.com/api/v4/projects/14233409/merge_requests/71/merge?should_remove_source_branch=False: + - metadata: + latency: 1.2172091007232666 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_pull_requests + - ogr.services.gitlab.pull_request + - gitlab.cli + - gitlab.exceptions + - gitlab.v4.objects.merge_requests + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + allow_collaboration: true + allow_maintainer_to_push: true + approvals_before_merge: null + assignee: null + assignees: [] + author: + avatar_url: https://secure.gravatar.com/avatar/96d32a99efb796de3669943fcf6e5bbb?s=80&d=identicon + id: 551273 + name: csomh + state: active + username: csomh + web_url: https://gitlab.com/csomh + blocking_discussions_resolved: true + changes_count: '1' + closed_at: null + closed_by: null + created_at: '2021-04-27T07:13:34.828Z' + description: "Signed-off-by: Hunor Csomort\xE1ni " + diff_refs: + base_sha: b8e18207cfdad954f1b3a96db34d0706b272e6cf + head_sha: 5dd0a9a1f5b9d3bf820e8849c4be7aafcbe9a8c7 + start_sha: b8e18207cfdad954f1b3a96db34d0706b272e6cf + discussion_locked: null + downvotes: 0 + first_deployed_to_production_at: null + force_remove_source_branch: true + has_conflicts: false + head_pipeline: null + id: 97512283 + iid: 71 + labels: [] + latest_build_finished_at: null + latest_build_started_at: null + merge_commit_sha: dd9b6c54c0788301c86bdf058a8e91e3594a0a17 + merge_error: null + merge_status: can_be_merged + merge_when_pipeline_succeeds: false + merged_at: '2021-04-27T07:18:37.595Z' + merged_by: + avatar_url: https://secure.gravatar.com/avatar/96d32a99efb796de3669943fcf6e5bbb?s=80&d=identicon + id: 551273 + name: csomh + state: active + username: csomh + web_url: https://gitlab.com/csomh + milestone: null + pipeline: null + project_id: 14233409 + reference: '!71' + references: + full: packit-service/ogr-tests!71 + relative: '!71' + short: '!71' + reviewers: [] + sha: 5dd0a9a1f5b9d3bf820e8849c4be7aafcbe9a8c7 + should_remove_source_branch: null + source_branch: test-mr-merge + source_project_id: 26200368 + squash: false + squash_commit_sha: null + state: merged + subscribed: true + target_branch: master + target_project_id: 14233409 + task_completion_status: + completed_count: 0 + count: 0 + time_stats: + human_time_estimate: null + human_total_time_spent: null + time_estimate: 0 + total_time_spent: 0 + title: Comit to test merging MRs + updated_at: '2021-04-27T07:18:37.563Z' + upvotes: 0 + user: + can_merge: true + user_notes_count: 0 + web_url: https://gitlab.com/packit-service/ogr-tests/-/merge_requests/71 + work_in_progress: false + _next: null + elapsed: 1.21656 + encoding: utf-8 + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 64664720b8f5413e-PRG + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Tue, 27 Apr 2021 07:18:38 GMT + Etag: W/"46984100a2a578317e80fb215a2f56fa" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-01-lb-gprd + GitLab-SV: localhost + RateLimit-Limit: '2000' + RateLimit-Observed: '3' + RateLimit-Remaining: '1997' + RateLimit-Reset: '1619507977' + RateLimit-ResetTime: Tue, 27 Apr 2021 07:19:37 GMT + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Accept-Encoding, Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: code_review + X-Request-Id: 01F4933C6KQNEV0VC1KXMDWSHH + X-Runtime: '0.947440' + cf-request-id: 09b3cac8740000413e292a4000000001 + raw: !!binary "" + reason: OK + status_code: 200 + https://gitlab.com/api/v4/projects/14233409/merge_requests/71/merge: + - metadata: + latency: 1.2172091007232666 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_pull_requests + - ogr.services.gitlab.pull_request + - gitlab.cli + - gitlab.exceptions + - gitlab.v4.objects.merge_requests + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + allow_collaboration: true + allow_maintainer_to_push: true + approvals_before_merge: null + assignee: null + assignees: [] + author: + avatar_url: https://secure.gravatar.com/avatar/96d32a99efb796de3669943fcf6e5bbb?s=80&d=identicon + id: 551273 + name: csomh + state: active + username: csomh + web_url: https://gitlab.com/csomh + blocking_discussions_resolved: true + changes_count: '1' + closed_at: null + closed_by: null + created_at: '2021-04-27T07:13:34.828Z' + description: "Signed-off-by: Hunor Csomort\xE1ni " + diff_refs: + base_sha: b8e18207cfdad954f1b3a96db34d0706b272e6cf + head_sha: 5dd0a9a1f5b9d3bf820e8849c4be7aafcbe9a8c7 + start_sha: b8e18207cfdad954f1b3a96db34d0706b272e6cf + discussion_locked: null + downvotes: 0 + first_deployed_to_production_at: null + force_remove_source_branch: true + has_conflicts: false + head_pipeline: null + id: 97512283 + iid: 71 + labels: [] + latest_build_finished_at: null + latest_build_started_at: null + merge_commit_sha: dd9b6c54c0788301c86bdf058a8e91e3594a0a17 + merge_error: null + merge_status: can_be_merged + merge_when_pipeline_succeeds: false + merged_at: '2021-04-27T07:18:37.595Z' + merged_by: + avatar_url: https://secure.gravatar.com/avatar/96d32a99efb796de3669943fcf6e5bbb?s=80&d=identicon + id: 551273 + name: csomh + state: active + username: csomh + web_url: https://gitlab.com/csomh + milestone: null + pipeline: null + project_id: 14233409 + reference: '!71' + references: + full: packit-service/ogr-tests!71 + relative: '!71' + short: '!71' + reviewers: [] + sha: 5dd0a9a1f5b9d3bf820e8849c4be7aafcbe9a8c7 + should_remove_source_branch: null + source_branch: test-mr-merge + source_project_id: 26200368 + squash: false + squash_commit_sha: null + state: merged + subscribed: true + target_branch: master + target_project_id: 14233409 + task_completion_status: + completed_count: 0 + count: 0 + time_stats: + human_time_estimate: null + human_total_time_spent: null + time_estimate: 0 + total_time_spent: 0 + title: Comit to test merging MRs + updated_at: '2021-04-27T07:18:37.563Z' + upvotes: 0 + user: + can_merge: true + user_notes_count: 0 + web_url: https://gitlab.com/packit-service/ogr-tests/-/merge_requests/71 + work_in_progress: false + _next: null + elapsed: 1.21656 + encoding: utf-8 + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 64664720b8f5413e-PRG + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Tue, 27 Apr 2021 07:18:38 GMT + Etag: W/"46984100a2a578317e80fb215a2f56fa" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-01-lb-gprd + GitLab-SV: localhost + RateLimit-Limit: '2000' + RateLimit-Observed: '3' + RateLimit-Remaining: '1997' + RateLimit-Reset: '1619507977' + RateLimit-ResetTime: Tue, 27 Apr 2021 07:19:37 GMT + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Accept-Encoding, Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: code_review + X-Request-Id: 01F4933C6KQNEV0VC1KXMDWSHH + X-Runtime: '0.947440' + cf-request-id: 09b3cac8740000413e292a4000000001 + raw: !!binary "" + reason: OK + status_code: 200 diff --git a/tests/integration/gitlab/test_data/test_pull_requests/tests.integration.gitlab.test_pull_requests.PullRequests.test_pr_merge.yaml b/tests/integration/gitlab/test_data/test_pull_requests/tests.integration.gitlab.test_pull_requests.PullRequests.test_pr_merge.yaml deleted file mode 100644 index 30cac6ce..00000000 --- a/tests/integration/gitlab/test_data/test_pull_requests/tests.integration.gitlab.test_pull_requests.PullRequests.test_pr_merge.yaml +++ /dev/null @@ -1,866 +0,0 @@ -_requre: - DataTypes: 1 - key_strategy: StorageKeysInspectSimple - version_storage_file: 2 -requests.sessions: - send: - GET: - https://gitlab.com/api/v4/projects/14233409/merge_requests/53: - - metadata: - latency: 0.2973959445953369 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.project - - ogr.services.gitlab.pull_request - - gitlab.exceptions - - gitlab.mixins - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - approvals_before_merge: null - assignee: null - assignees: [] - author: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - id: 375555 - name: Matej Focko - state: active - username: mfocko - web_url: https://gitlab.com/mfocko - blocking_discussions_resolved: true - changes_count: '1' - closed_at: null - closed_by: null - created_at: '2020-08-28T08:49:02.322Z' - description: '' - diff_refs: - base_sha: 257ce9fd8c5421d2e116337847710ba70d215aa6 - head_sha: 59b1a9bab5b5198c619270646410867788685c16 - start_sha: 257ce9fd8c5421d2e116337847710ba70d215aa6 - discussion_locked: null - downvotes: 0 - first_contribution: false - first_deployed_to_production_at: null - force_remove_source_branch: false - has_conflicts: false - head_pipeline: null - id: 69040003 - iid: 53 - labels: [] - latest_build_finished_at: null - latest_build_started_at: null - merge_commit_sha: null - merge_error: null - merge_status: can_be_merged - merge_when_pipeline_succeeds: false - merged_at: null - merged_by: null - milestone: null - pipeline: null - project_id: 14233409 - reference: '!53' - references: - full: packit-service/ogr-tests!53 - relative: '!53' - short: '!53' - sha: 59b1a9bab5b5198c619270646410867788685c16 - should_remove_source_branch: null - source_branch: test_branch - source_project_id: 14233409 - squash: false - squash_commit_sha: null - state: opened - subscribed: true - target_branch: pr-test1 - target_project_id: 14233409 - task_completion_status: - completed_count: 0 - count: 0 - time_stats: - human_time_estimate: null - human_total_time_spent: null - time_estimate: 0 - total_time_spent: 0 - title: Test branch - updated_at: '2020-08-28T08:49:02.322Z' - upvotes: 0 - user: - can_merge: true - user_notes_count: 0 - web_url: https://gitlab.com/packit-service/ogr-tests/-/merge_requests/53 - work_in_progress: false - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5c9cc9c60ae3fca9-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"79912114cbb885eaae51bc78efbfeb1f" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-02-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '3' - RateLimit-Remaining: '597' - RateLimit-Reset: '1598604722' - RateLimit-ResetTime: Fri, 28 Aug 2020 08:52:02 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: syFdWoCC9d2 - X-Runtime: '0.077280' - cf-request-id: 04d5dc6fc30000fca95aa9e200000001 - raw: !!binary "" - reason: OK - status_code: 200 - - metadata: - latency: 0.2871544361114502 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.project - - ogr.services.gitlab.pull_request - - gitlab.exceptions - - gitlab.mixins - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - approvals_before_merge: null - assignee: null - assignees: [] - author: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - id: 375555 - name: Matej Focko - state: active - username: mfocko - web_url: https://gitlab.com/mfocko - blocking_discussions_resolved: true - changes_count: '1' - closed_at: null - closed_by: null - created_at: '2020-08-28T08:49:02.322Z' - description: '' - diff_refs: - base_sha: 257ce9fd8c5421d2e116337847710ba70d215aa6 - head_sha: 59b1a9bab5b5198c619270646410867788685c16 - start_sha: 257ce9fd8c5421d2e116337847710ba70d215aa6 - discussion_locked: null - downvotes: 0 - first_contribution: false - first_deployed_to_production_at: null - force_remove_source_branch: false - has_conflicts: false - head_pipeline: null - id: 69040003 - iid: 53 - labels: [] - latest_build_finished_at: null - latest_build_started_at: null - merge_commit_sha: 353361738fdefd9cd4f9fd669fa1c5792b9fe299 - merge_error: null - merge_status: can_be_merged - merge_when_pipeline_succeeds: false - merged_at: '2020-08-28T08:51:03.924Z' - merged_by: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - id: 375555 - name: Matej Focko - state: active - username: mfocko - web_url: https://gitlab.com/mfocko - milestone: null - pipeline: null - project_id: 14233409 - reference: '!53' - references: - full: packit-service/ogr-tests!53 - relative: '!53' - short: '!53' - sha: 59b1a9bab5b5198c619270646410867788685c16 - should_remove_source_branch: null - source_branch: test_branch - source_project_id: 14233409 - squash: false - squash_commit_sha: null - state: merged - subscribed: true - target_branch: pr-test1 - target_project_id: 14233409 - task_completion_status: - completed_count: 0 - count: 0 - time_stats: - human_time_estimate: null - human_total_time_spent: null - time_estimate: 0 - total_time_spent: 0 - title: Test branch - updated_at: '2020-08-28T08:51:03.883Z' - upvotes: 0 - user: - can_merge: true - user_notes_count: 0 - web_url: https://gitlab.com/packit-service/ogr-tests/-/merge_requests/53 - work_in_progress: false - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5cb569aacd5bfc9d-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"51bba6694c1289cef8717127403d3c0c" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-01-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '126' - RateLimit-Remaining: '474' - RateLimit-Reset: '1598862930' - RateLimit-ResetTime: Mon, 31 Aug 2020 08:35:30 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: FVI86KWygo1 - X-Runtime: '0.095563' - cf-request-id: 04e5405ec10000fc9d002cc200000001 - raw: !!binary "" - reason: OK - status_code: 200 - https://gitlab.com/api/v4/projects/packit-service%2Fogr-tests: - - metadata: - latency: 0.336749792098999 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.project - - ogr.services.gitlab.pull_request - - ogr.services.gitlab.project - - gitlab.exceptions - - gitlab.mixins - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - _links: - events: https://gitlab.com/api/v4/projects/14233409/events - issues: https://gitlab.com/api/v4/projects/14233409/issues - labels: https://gitlab.com/api/v4/projects/14233409/labels - members: https://gitlab.com/api/v4/projects/14233409/members - merge_requests: https://gitlab.com/api/v4/projects/14233409/merge_requests - repo_branches: https://gitlab.com/api/v4/projects/14233409/repository/branches - self: https://gitlab.com/api/v4/projects/14233409 - allow_merge_on_skipped_pipeline: null - approvals_before_merge: 0 - archived: false - auto_cancel_pending_pipelines: enabled - auto_devops_deploy_strategy: continuous - auto_devops_enabled: false - autoclose_referenced_issues: true - avatar_url: null - build_coverage_regex: null - build_git_strategy: fetch - build_timeout: 3600 - builds_access_level: enabled - can_create_merge_request_in: true - ci_config_path: null - ci_default_git_depth: 50 - compliance_frameworks: [] - container_registry_enabled: true - created_at: '2019-09-10T10:28:09.946Z' - creator_id: 433670 - default_branch: master - description: Testing repository for python-ogr package. | https://github.com/packit-service/ogr - emails_disabled: null - empty_repo: false - external_authorization_classification_label: '' - forking_access_level: enabled - forks_count: 4 - http_url_to_repo: https://gitlab.com/packit-service/ogr-tests.git - id: 14233409 - import_error: null - import_status: none - issues_access_level: enabled - issues_enabled: true - jobs_enabled: true - last_activity_at: '2020-08-28T08:35:53.095Z' - lfs_enabled: true - marked_for_deletion_at: null - marked_for_deletion_on: null - merge_method: merge - merge_requests_access_level: enabled - merge_requests_enabled: true - mirror: false - name: ogr-tests - name_with_namespace: packit-service / ogr-tests - namespace: - avatar_url: /uploads/-/system/group/avatar/6032704/packit-logo.png - full_path: packit-service - id: 6032704 - kind: group - name: packit-service - parent_id: null - path: packit-service - web_url: https://gitlab.com/groups/packit-service - only_allow_merge_if_all_discussions_are_resolved: false - only_allow_merge_if_pipeline_succeeds: false - open_issues_count: 54 - packages_enabled: true - pages_access_level: enabled - path: ogr-tests - path_with_namespace: packit-service/ogr-tests - permissions: - group_access: - access_level: 40 - notification_level: 3 - project_access: null - printing_merge_request_link_enabled: true - public_jobs: true - readme_url: https://gitlab.com/packit-service/ogr-tests/-/blob/master/README.md - remove_source_branch_after_merge: null - repository_access_level: enabled - request_access_enabled: false - resolve_outdated_diff_discussions: false - runners_token: VjGdzzwZbsTY37sxUeWL - service_desk_address: incoming+packit-service-ogr-tests-14233409-issue-@incoming.gitlab.com - service_desk_enabled: true - shared_runners_enabled: true - shared_with_groups: [] - snippets_access_level: enabled - snippets_enabled: true - ssh_url_to_repo: git@gitlab.com:packit-service/ogr-tests.git - star_count: 0 - suggestion_commit_message: null - tag_list: [] - visibility: public - web_url: https://gitlab.com/packit-service/ogr-tests - wiki_access_level: enabled - wiki_enabled: true - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5c9cc9c3dfc1fca9-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"1978cc0f8c6bb454dcef73c96acdcf54" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-10-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '2' - RateLimit-Remaining: '598' - RateLimit-Reset: '1598604722' - RateLimit-ResetTime: Fri, 28 Aug 2020 08:52:02 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: eA4uTQBx8G2 - X-Runtime: '0.111954' - cf-request-id: 04d5dc6e6a0000fca95aa90200000001 - raw: !!binary "" - reason: OK - status_code: 200 - - metadata: - latency: 0.2718820571899414 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.project - - ogr.services.gitlab.pull_request - - ogr.services.gitlab.project - - gitlab.exceptions - - gitlab.mixins - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - _links: - events: https://gitlab.com/api/v4/projects/14233409/events - issues: https://gitlab.com/api/v4/projects/14233409/issues - labels: https://gitlab.com/api/v4/projects/14233409/labels - members: https://gitlab.com/api/v4/projects/14233409/members - merge_requests: https://gitlab.com/api/v4/projects/14233409/merge_requests - repo_branches: https://gitlab.com/api/v4/projects/14233409/repository/branches - self: https://gitlab.com/api/v4/projects/14233409 - allow_merge_on_skipped_pipeline: null - approvals_before_merge: 0 - archived: false - auto_cancel_pending_pipelines: enabled - auto_devops_deploy_strategy: continuous - auto_devops_enabled: false - autoclose_referenced_issues: true - avatar_url: null - build_coverage_regex: null - build_git_strategy: fetch - build_timeout: 3600 - builds_access_level: enabled - can_create_merge_request_in: true - ci_config_path: null - ci_default_git_depth: 50 - compliance_frameworks: [] - container_registry_enabled: true - created_at: '2019-09-10T10:28:09.946Z' - creator_id: 433670 - default_branch: master - description: Testing repository for python-ogr package. | https://github.com/packit-service/ogr - emails_disabled: null - empty_repo: false - external_authorization_classification_label: '' - forking_access_level: enabled - forks_count: 4 - http_url_to_repo: https://gitlab.com/packit-service/ogr-tests.git - id: 14233409 - import_error: null - import_status: none - issues_access_level: enabled - issues_enabled: true - jobs_enabled: true - last_activity_at: '2020-08-31T08:32:55.070Z' - lfs_enabled: true - marked_for_deletion_at: null - marked_for_deletion_on: null - merge_method: merge - merge_requests_access_level: enabled - merge_requests_enabled: true - mirror: false - name: ogr-tests - name_with_namespace: packit-service / ogr-tests - namespace: - avatar_url: /uploads/-/system/group/avatar/6032704/packit-logo.png - full_path: packit-service - id: 6032704 - kind: group - name: packit-service - parent_id: null - path: packit-service - web_url: https://gitlab.com/groups/packit-service - only_allow_merge_if_all_discussions_are_resolved: false - only_allow_merge_if_pipeline_succeeds: false - open_issues_count: 56 - packages_enabled: true - pages_access_level: enabled - path: ogr-tests - path_with_namespace: packit-service/ogr-tests - permissions: - group_access: - access_level: 40 - notification_level: 3 - project_access: null - printing_merge_request_link_enabled: true - public_jobs: true - readme_url: https://gitlab.com/packit-service/ogr-tests/-/blob/master/README.md - remove_source_branch_after_merge: null - repository_access_level: enabled - request_access_enabled: false - resolve_outdated_diff_discussions: false - runners_token: VjGdzzwZbsTY37sxUeWL - service_desk_address: incoming+packit-service-ogr-tests-14233409-issue-@incoming.gitlab.com - service_desk_enabled: true - shared_runners_enabled: true - shared_with_groups: [] - snippets_access_level: enabled - snippets_enabled: true - ssh_url_to_repo: git@gitlab.com:packit-service/ogr-tests.git - star_count: 0 - suggestion_commit_message: null - tag_list: [] - visibility: public - web_url: https://gitlab.com/packit-service/ogr-tests - wiki_access_level: enabled - wiki_enabled: true - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5cb569a909f1fc9d-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"0e711dc52726ed86f49c4cf226f050c3" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-02-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '125' - RateLimit-Remaining: '474' - RateLimit-Reset: '1598862930' - RateLimit-ResetTime: Mon, 31 Aug 2020 08:35:30 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: VPwQF5FwRs7 - X-Runtime: '0.085231' - cf-request-id: 04e5405da40000fc9d002a2200000001 - raw: !!binary "" - reason: OK - status_code: 200 - https://gitlab.com/api/v4/user: - - metadata: - latency: 0.33644628524780273 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.project - - ogr.services.gitlab.pull_request - - ogr.services.gitlab.project - - ogr.services.gitlab.service - - gitlab - - gitlab.exceptions - - gitlab.mixins - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - bio: '' - bio_html: '' - can_create_group: true - can_create_project: true - color_scheme_id: 4 - confirmed_at: '2020-07-24T20:00:33.764Z' - created_at: '2016-01-15T21:12:31.705Z' - current_sign_in_at: '2020-08-27T09:28:33.626Z' - email: matej.focko@outlook.com - external: false - extra_shared_runners_minutes_limit: null - id: 375555 - identities: [] - job_title: '' - last_activity_on: '2020-08-28' - last_sign_in_at: '2020-07-24T21:14:08.642Z' - linkedin: '' - location: "Ko\u0161ice, Slovakia" - name: Matej Focko - organization: '' - private_profile: false - projects_limit: 100000 - public_email: '' - shared_runners_minutes_limit: 2000 - skype: '' - state: active - theme_id: 7 - twitter: MatejFocko - two_factor_enabled: true - username: mfocko - web_url: https://gitlab.com/mfocko - website_url: '' - work_information: null - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5c9cc9c20d2dfca9-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"15c2841db82c44f1179f6399dfda42a3" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-10-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '1' - RateLimit-Remaining: '599' - RateLimit-Reset: '1598604722' - RateLimit-ResetTime: Fri, 28 Aug 2020 08:52:02 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Set-Cookie: __cfduid=d5871ff3e56134deb6ceb952b9de5860a1598604662; expires=Sun, - 27-Sep-20 08:51:02 GMT; path=/; domain=.gitlab.com; HttpOnly; SameSite=Lax; - Secure - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: VYHL5XwJcC5 - X-Runtime: '0.033354' - cf-request-id: 04d5dc6d490000fca95aa82200000001 - raw: !!binary "" - reason: OK - status_code: 200 - - metadata: - latency: 0.36286020278930664 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.project - - ogr.services.gitlab.pull_request - - ogr.services.gitlab.project - - ogr.services.gitlab.service - - gitlab - - gitlab.exceptions - - gitlab.mixins - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - bio: '' - bio_html: '' - can_create_group: true - can_create_project: true - color_scheme_id: 4 - confirmed_at: '2020-07-24T20:00:33.764Z' - created_at: '2016-01-15T21:12:31.705Z' - current_sign_in_at: '2020-08-27T09:28:33.626Z' - email: matej.focko@outlook.com - external: false - extra_shared_runners_minutes_limit: null - id: 375555 - identities: [] - job_title: '' - last_activity_on: '2020-08-31' - last_sign_in_at: '2020-07-24T21:14:08.642Z' - linkedin: '' - location: "Ko\u0161ice, Slovakia" - name: Matej Focko - organization: '' - private_profile: false - projects_limit: 100000 - public_email: '' - shared_runners_minutes_limit: 2000 - skype: '' - state: active - theme_id: 7 - twitter: MatejFocko - two_factor_enabled: true - username: mfocko - web_url: https://gitlab.com/mfocko - website_url: '' - work_information: null - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5cb569a78febfc9d-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"200774d261a50e11c2ad70cff27c4040" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-01-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '125' - RateLimit-Remaining: '475' - RateLimit-Reset: '1598862929' - RateLimit-ResetTime: Mon, 31 Aug 2020 08:35:29 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Set-Cookie: __cfduid=dea0cc44c6bf77f0aea84d4bbe8d161d21598862869; expires=Wed, - 30-Sep-20 08:34:29 GMT; path=/; domain=.gitlab.com; HttpOnly; SameSite=Lax; - Secure - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: 3Ry5IR6jjB6 - X-Runtime: '0.051815' - cf-request-id: 04e5405cb30000fc9d00280200000001 - raw: !!binary "" - reason: OK - status_code: 200 - PUT: - https://gitlab.com/api/v4/projects/14233409/merge_requests/53/merge: - - metadata: - latency: 1.3266112804412842 - module_call_list: - - unittest.case - - requre.online_replacing - - tests.integration.gitlab.test_pull_requests - - ogr.services.gitlab.pull_request - - gitlab.cli - - gitlab.exceptions - - gitlab.v4.objects - - gitlab - - requre.objects - - requre.cassette - - requests.sessions - - send - output: - __store_indicator: 2 - _content: - approvals_before_merge: null - assignee: null - assignees: [] - author: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - id: 375555 - name: Matej Focko - state: active - username: mfocko - web_url: https://gitlab.com/mfocko - blocking_discussions_resolved: true - changes_count: '1' - closed_at: null - closed_by: null - created_at: '2020-08-28T08:49:02.322Z' - description: '' - diff_refs: - base_sha: 257ce9fd8c5421d2e116337847710ba70d215aa6 - head_sha: 59b1a9bab5b5198c619270646410867788685c16 - start_sha: 257ce9fd8c5421d2e116337847710ba70d215aa6 - discussion_locked: null - downvotes: 0 - first_deployed_to_production_at: null - force_remove_source_branch: false - has_conflicts: false - head_pipeline: null - id: 69040003 - iid: 53 - labels: [] - latest_build_finished_at: null - latest_build_started_at: null - merge_commit_sha: 353361738fdefd9cd4f9fd669fa1c5792b9fe299 - merge_error: null - merge_status: can_be_merged - merge_when_pipeline_succeeds: false - merged_at: '2020-08-28T08:51:03.924Z' - merged_by: - avatar_url: https://assets.gitlab-static.net/uploads/-/system/user/avatar/375555/avatar.png - id: 375555 - name: Matej Focko - state: active - username: mfocko - web_url: https://gitlab.com/mfocko - milestone: null - pipeline: null - project_id: 14233409 - reference: '!53' - references: - full: packit-service/ogr-tests!53 - relative: '!53' - short: '!53' - sha: 59b1a9bab5b5198c619270646410867788685c16 - should_remove_source_branch: null - source_branch: test_branch - source_project_id: 14233409 - squash: false - squash_commit_sha: null - state: merged - subscribed: true - target_branch: pr-test1 - target_project_id: 14233409 - task_completion_status: - completed_count: 0 - count: 0 - time_stats: - human_time_estimate: null - human_total_time_spent: null - time_estimate: 0 - total_time_spent: 0 - title: Test branch - updated_at: '2020-08-28T08:51:03.883Z' - upvotes: 0 - user: - can_merge: true - user_notes_count: 0 - web_url: https://gitlab.com/packit-service/ogr-tests/-/merge_requests/53 - work_in_progress: false - _next: null - elapsed: 0.2 - encoding: null - headers: - CF-Cache-Status: DYNAMIC - CF-RAY: 5c9cc9c7fdc5fca9-VIE - Cache-Control: max-age=0, private, must-revalidate - Connection: keep-alive - Content-Encoding: gzip - Content-Type: application/json - Date: Fri, 01 Nov 2019 13-36-03 GMT - Etag: W/"29a01fd67275e920cdf7e035f1a345b7" - Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" - GitLab-LB: fe-06-lb-gprd - GitLab-SV: localhost - RateLimit-Limit: '600' - RateLimit-Observed: '4' - RateLimit-Remaining: '596' - RateLimit-Reset: '1598604724' - RateLimit-ResetTime: Fri, 28 Aug 2020 08:52:04 GMT - Referrer-Policy: strict-origin-when-cross-origin - Server: cloudflare - Strict-Transport-Security: max-age=31536000 - Transfer-Encoding: chunked - Vary: Accept-Encoding, Origin - X-Content-Type-Options: nosniff - X-Frame-Options: SAMEORIGIN - X-Request-Id: 05ddUVUgPF8 - X-Runtime: '1.083370' - cf-request-id: 04d5dc70f60000fca95aaae200000001 - raw: !!binary "" - reason: OK - status_code: 200 diff --git a/tests/integration/gitlab/test_pull_requests.py b/tests/integration/gitlab/test_pull_requests.py index bbd522ce..28085475 100644 --- a/tests/integration/gitlab/test_pull_requests.py +++ b/tests/integration/gitlab/test_pull_requests.py @@ -1,3 +1,6 @@ +# Copyright Contributors to the Packit project. +# SPDX-License-Identifier: MIT + from requre.online_replacing import record_requests_for_all_methods from tests.integration.gitlab.base import GitlabTests @@ -71,10 +74,14 @@ def test_pr_merge(self): """ Create new PR and update pull request ID to this test before this test """ - pull_request_id = 53 + pull_request_id = 71 pr_for_merging = self.project.get_pr(pr_id=pull_request_id) assert pr_for_merging.status == PRStatus.open + # WARNING: this produces different PUT calls depending on + # the version of python-gitlab (<2.7.0 or >=2.7.0). + # Duplicate and manually fix the URL in the requre cassette + # in order to work around this. merged_pr = pr_for_merging.merge() assert merged_pr.status == PRStatus.merged From 9d18f26774860db1f6149d6e1835486b03c22884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= Date: Tue, 27 Apr 2021 10:21:30 +0200 Subject: [PATCH 3/4] GitHub: Fix breaking API change in get_emails() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit get_emails() might return a list of named tuples instead of a list of dictionaries in newer versions of PyGithub. Handle this case in backward compatible manner. Signed-off-by: Hunor Csomortáni --- ogr/services/github/user.py | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/ogr/services/github/user.py b/ogr/services/github/user.py index 4fd10910..d247cd0d 100644 --- a/ogr/services/github/user.py +++ b/ogr/services/github/user.py @@ -1,25 +1,7 @@ -# MIT License -# -# Copyright (c) 2018-2019 Red Hat, Inc. - -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -# SOFTWARE. +# Copyright Contributors to the Packit project. +# SPDX-License-Identifier: MIT +from collections import namedtuple from typing import Optional, List from ogr.services import github as ogr_github @@ -53,9 +35,15 @@ def get_email(self) -> Optional[str]: if not user_emails: return None - for email_dict in user_emails: - if email_dict["primary"]: - return email_dict["email"] + # To work around the braking change introduced by pygithub==1.55 + # https://pygithub.readthedocs.io/en/latest/changes.html#version-1-55-april-26-2021 + if isinstance(user_emails[0], dict): + EmailData = namedtuple("EmailData", user_emails[0].keys()) # type: ignore + for email in user_emails: + if "EmailData" in locals(): + email = EmailData(**email) # type: ignore + if email.primary: + return email.email # Return the first email we received return user_emails[0]["email"] From 6c4edb6477b9a1c3715d238dd1d1748a1084dcfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hunor=20Csomort=C3=A1ni?= Date: Tue, 27 Apr 2021 10:24:20 +0200 Subject: [PATCH 4/4] Call 'make check' in 'make check-in-container' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will make the two targets more consistent. Signed-off-by: Hunor Csomortáni --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 288fcc9f..8958188f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ BASE_IMAGE := fedora:latest -TEST_TARGET := ./tests/ +TEST_TARGET ?= ./tests/ PY_PACKAGE := ogr OGR_IMAGE := ogr @@ -12,10 +12,10 @@ prepare-check: check: @#`python3 -m pytest` doesn't work here b/c the way requre overrides import system: @#`AttributeError: module 'importlib_metadata' has no attribute 'distributions' - PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 pytest-3 --verbose --showlocals $(TEST_TARGET) + PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 pytest --verbose --showlocals $(TEST_TARGET) check-in-container: - podman run --rm -it -v $(CURDIR):/src:Z -w /src $(OGR_IMAGE) pytest-3 $(TEST_TARGET) + podman run --rm -it -v $(CURDIR):/src:Z -w /src $(OGR_IMAGE) make check shell: podman run --rm -ti -v $(CURDIR):/src:Z -w /src $(OGR_IMAGE) bash