diff --git a/ogr/abstract.py b/ogr/abstract.py index 1a766f0d..adeba515 100644 --- a/ogr/abstract.py +++ b/ogr/abstract.py @@ -299,6 +299,14 @@ def add_label(self, *labels: str) -> None: """ raise NotImplementedError() + def add_assignee(self, *assignees: str) -> None: + """ + Assign users to an issue. + + :param assignees: [str] + """ + raise NotImplementedError() + class PRStatus(IntEnum): open = 1 diff --git a/ogr/services/github/issue.py b/ogr/services/github/issue.py index 9c6f9600..112af98c 100644 --- a/ogr/services/github/issue.py +++ b/ogr/services/github/issue.py @@ -164,3 +164,6 @@ def close(self) -> "Issue": def add_label(self, *labels: str) -> None: for label in labels: self._raw_issue.add_to_labels(label) + + def add_assignee(self, *assignees: str) -> None: + self._raw_issue.edit(assignees=list(assignees)) diff --git a/ogr/services/gitlab/issue.py b/ogr/services/gitlab/issue.py index 84e30fa9..90fec4e5 100644 --- a/ogr/services/gitlab/issue.py +++ b/ogr/services/gitlab/issue.py @@ -67,7 +67,10 @@ def url(self) -> str: @property def assignees(self) -> list: - return self._raw_issue.assignees + try: + return self._raw_issue.assignees + except AttributeError: + return None # if issue has no assignees, the attribute is not present @property def description(self) -> str: @@ -171,3 +174,18 @@ def add_label(self, *labels: str) -> None: for label in labels: self._raw_issue.labels.append(label) self._raw_issue.save() + + def add_assignee(self, *assignees: str) -> None: + assignee_ids = self._raw_issue.__dict__.get("assignee_ids") or [] + for assignee in assignees: + users = self.project.service.gitlab_instance.users.list( # type: ignore + username=assignee + ) + if not users: + raise GitlabAPIException(f"Unable to find '{assignee}' username") + uid = str(users[0].id) + if uid not in assignee_ids: + assignee_ids.append(str(users[0].id)) + + self._raw_issue.assignee_ids = assignee_ids + self._raw_issue.save() diff --git a/ogr/services/pagure/issue.py b/ogr/services/pagure/issue.py index e3d7c7d1..d6f2ec51 100644 --- a/ogr/services/pagure/issue.py +++ b/ogr/services/pagure/issue.py @@ -74,7 +74,10 @@ def url(self) -> str: @property def assignee(self) -> str: self.__update() - return self._raw_issue["assignee"]["name"] + try: + return self._raw_issue["assignee"]["name"] + except Exception: + return None @property def description(self) -> str: @@ -203,3 +206,11 @@ def close(self) -> "PagureIssue": ) self.__dirty = True return self + + def add_assignee(self, *assignees: str) -> None: + if len(assignees) > 1: + raise PagureAPIException("Pagure does not support multiple assignees") + payload = {"assignee": assignees[0]} + self.project._call_project_api( + "issue", str(self.id), "assign", data=payload, method="POST" + ) diff --git a/tests/integration/github/test_data/test_issues/Issues.test_issue_assignees.yaml b/tests/integration/github/test_data/test_issues/Issues.test_issue_assignees.yaml new file mode 100644 index 00000000..e4f1f3c9 --- /dev/null +++ b/tests/integration/github/test_data/test_issues/Issues.test_issue_assignees.yaml @@ -0,0 +1,834 @@ +_requre: + DataTypes: 1 + key_strategy: StorageKeysInspectSimple + version_storage_file: 3 +requests.sessions: + send: + GET: + https://api.github.com:443/repos/KPostOffice/ogr: + - metadata: + latency: 0.1761307716369629 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.github.test_issues + - ogr.utils + - ogr.services.github.issue + - ogr.services.github.project + - github.MainClass + - github.Requester + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + allow_merge_commit: true + allow_rebase_merge: true + allow_squash_merge: true + archive_url: https://api.github.com/repos/KPostOffice/ogr/{archive_format}{/ref} + archived: false + assignees_url: https://api.github.com/repos/KPostOffice/ogr/assignees{/user} + blobs_url: https://api.github.com/repos/KPostOffice/ogr/git/blobs{/sha} + branches_url: https://api.github.com/repos/KPostOffice/ogr/branches{/branch} + clone_url: https://github.com/KPostOffice/ogr.git + collaborators_url: https://api.github.com/repos/KPostOffice/ogr/collaborators{/collaborator} + comments_url: https://api.github.com/repos/KPostOffice/ogr/comments{/number} + commits_url: https://api.github.com/repos/KPostOffice/ogr/commits{/sha} + compare_url: https://api.github.com/repos/KPostOffice/ogr/compare/{base}...{head} + contents_url: https://api.github.com/repos/KPostOffice/ogr/contents/{+path} + contributors_url: https://api.github.com/repos/KPostOffice/ogr/contributors + created_at: '2021-05-25T15:39:31Z' + default_branch: main + delete_branch_on_merge: false + deployments_url: https://api.github.com/repos/KPostOffice/ogr/deployments + description: One Git library to Rule -- one API for many git forges + disabled: false + downloads_url: https://api.github.com/repos/KPostOffice/ogr/downloads + events_url: https://api.github.com/repos/KPostOffice/ogr/events + fork: true + forks: 0 + forks_count: 0 + forks_url: https://api.github.com/repos/KPostOffice/ogr/forks + full_name: KPostOffice/ogr + git_commits_url: https://api.github.com/repos/KPostOffice/ogr/git/commits{/sha} + git_refs_url: https://api.github.com/repos/KPostOffice/ogr/git/refs{/sha} + git_tags_url: https://api.github.com/repos/KPostOffice/ogr/git/tags{/sha} + git_url: git://github.com/KPostOffice/ogr.git + has_downloads: true + has_issues: true + has_pages: false + has_projects: true + has_wiki: true + homepage: '' + hooks_url: https://api.github.com/repos/KPostOffice/ogr/hooks + html_url: https://github.com/KPostOffice/ogr + id: 370744918 + issue_comment_url: https://api.github.com/repos/KPostOffice/ogr/issues/comments{/number} + issue_events_url: https://api.github.com/repos/KPostOffice/ogr/issues/events{/number} + issues_url: https://api.github.com/repos/KPostOffice/ogr/issues{/number} + keys_url: https://api.github.com/repos/KPostOffice/ogr/keys{/key_id} + labels_url: https://api.github.com/repos/KPostOffice/ogr/labels{/name} + language: null + languages_url: https://api.github.com/repos/KPostOffice/ogr/languages + license: + key: mit + name: MIT License + node_id: MDc6TGljZW5zZTEz + spdx_id: MIT + url: https://api.github.com/licenses/mit + merges_url: https://api.github.com/repos/KPostOffice/ogr/merges + milestones_url: https://api.github.com/repos/KPostOffice/ogr/milestones{/number} + mirror_url: null + name: ogr + network_count: 45 + node_id: MDEwOlJlcG9zaXRvcnkzNzA3NDQ5MTg= + notifications_url: https://api.github.com/repos/KPostOffice/ogr/notifications{?since,all,participating} + open_issues: 4 + open_issues_count: 4 + owner: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + parent: + archive_url: https://api.github.com/repos/packit/ogr/{archive_format}{/ref} + archived: false + assignees_url: https://api.github.com/repos/packit/ogr/assignees{/user} + blobs_url: https://api.github.com/repos/packit/ogr/git/blobs{/sha} + branches_url: https://api.github.com/repos/packit/ogr/branches{/branch} + clone_url: https://github.com/packit/ogr.git + collaborators_url: https://api.github.com/repos/packit/ogr/collaborators{/collaborator} + comments_url: https://api.github.com/repos/packit/ogr/comments{/number} + commits_url: https://api.github.com/repos/packit/ogr/commits{/sha} + compare_url: https://api.github.com/repos/packit/ogr/compare/{base}...{head} + contents_url: https://api.github.com/repos/packit/ogr/contents/{+path} + contributors_url: https://api.github.com/repos/packit/ogr/contributors + created_at: '2018-12-13T12:33:52Z' + default_branch: main + deployments_url: https://api.github.com/repos/packit/ogr/deployments + description: One Git library to Rule -- one API for many git forges + disabled: false + downloads_url: https://api.github.com/repos/packit/ogr/downloads + events_url: https://api.github.com/repos/packit/ogr/events + fork: false + forks: 45 + forks_count: 45 + forks_url: https://api.github.com/repos/packit/ogr/forks + full_name: packit/ogr + git_commits_url: https://api.github.com/repos/packit/ogr/git/commits{/sha} + git_refs_url: https://api.github.com/repos/packit/ogr/git/refs{/sha} + git_tags_url: https://api.github.com/repos/packit/ogr/git/tags{/sha} + git_url: git://github.com/packit/ogr.git + has_downloads: true + has_issues: true + has_pages: true + has_projects: true + has_wiki: true + homepage: '' + hooks_url: https://api.github.com/repos/packit/ogr/hooks + html_url: https://github.com/packit/ogr + id: 161636700 + issue_comment_url: https://api.github.com/repos/packit/ogr/issues/comments{/number} + issue_events_url: https://api.github.com/repos/packit/ogr/issues/events{/number} + issues_url: https://api.github.com/repos/packit/ogr/issues{/number} + keys_url: https://api.github.com/repos/packit/ogr/keys{/key_id} + labels_url: https://api.github.com/repos/packit/ogr/labels{/name} + language: Python + languages_url: https://api.github.com/repos/packit/ogr/languages + license: + key: mit + name: MIT License + node_id: MDc6TGljZW5zZTEz + spdx_id: MIT + url: https://api.github.com/licenses/mit + merges_url: https://api.github.com/repos/packit/ogr/merges + milestones_url: https://api.github.com/repos/packit/ogr/milestones{/number} + mirror_url: null + name: ogr + node_id: MDEwOlJlcG9zaXRvcnkxNjE2MzY3MDA= + notifications_url: https://api.github.com/repos/packit/ogr/notifications{?since,all,participating} + open_issues: 27 + open_issues_count: 27 + owner: + avatar_url: https://avatars.githubusercontent.com/u/46870917?v=4 + events_url: https://api.github.com/users/packit/events{/privacy} + followers_url: https://api.github.com/users/packit/followers + following_url: https://api.github.com/users/packit/following{/other_user} + gists_url: https://api.github.com/users/packit/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/packit + id: 46870917 + login: packit + node_id: MDEyOk9yZ2FuaXphdGlvbjQ2ODcwOTE3 + organizations_url: https://api.github.com/users/packit/orgs + received_events_url: https://api.github.com/users/packit/received_events + repos_url: https://api.github.com/users/packit/repos + site_admin: false + starred_url: https://api.github.com/users/packit/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/packit/subscriptions + type: Organization + url: https://api.github.com/users/packit + private: false + pulls_url: https://api.github.com/repos/packit/ogr/pulls{/number} + pushed_at: '2021-06-02T13:27:10Z' + releases_url: https://api.github.com/repos/packit/ogr/releases{/id} + size: 11453 + ssh_url: git@github.com:packit/ogr.git + stargazers_count: 31 + stargazers_url: https://api.github.com/repos/packit/ogr/stargazers + statuses_url: https://api.github.com/repos/packit/ogr/statuses/{sha} + subscribers_url: https://api.github.com/repos/packit/ogr/subscribers + subscription_url: https://api.github.com/repos/packit/ogr/subscription + svn_url: https://github.com/packit/ogr + tags_url: https://api.github.com/repos/packit/ogr/tags + teams_url: https://api.github.com/repos/packit/ogr/teams + trees_url: https://api.github.com/repos/packit/ogr/git/trees{/sha} + updated_at: '2021-06-01T14:41:40Z' + url: https://api.github.com/repos/packit/ogr + watchers: 31 + watchers_count: 31 + permissions: + admin: true + pull: true + push: true + private: false + pulls_url: https://api.github.com/repos/KPostOffice/ogr/pulls{/number} + pushed_at: '2021-05-25T20:22:14Z' + releases_url: https://api.github.com/repos/KPostOffice/ogr/releases{/id} + size: 11449 + source: + archive_url: https://api.github.com/repos/packit/ogr/{archive_format}{/ref} + archived: false + assignees_url: https://api.github.com/repos/packit/ogr/assignees{/user} + blobs_url: https://api.github.com/repos/packit/ogr/git/blobs{/sha} + branches_url: https://api.github.com/repos/packit/ogr/branches{/branch} + clone_url: https://github.com/packit/ogr.git + collaborators_url: https://api.github.com/repos/packit/ogr/collaborators{/collaborator} + comments_url: https://api.github.com/repos/packit/ogr/comments{/number} + commits_url: https://api.github.com/repos/packit/ogr/commits{/sha} + compare_url: https://api.github.com/repos/packit/ogr/compare/{base}...{head} + contents_url: https://api.github.com/repos/packit/ogr/contents/{+path} + contributors_url: https://api.github.com/repos/packit/ogr/contributors + created_at: '2018-12-13T12:33:52Z' + default_branch: main + deployments_url: https://api.github.com/repos/packit/ogr/deployments + description: One Git library to Rule -- one API for many git forges + disabled: false + downloads_url: https://api.github.com/repos/packit/ogr/downloads + events_url: https://api.github.com/repos/packit/ogr/events + fork: false + forks: 45 + forks_count: 45 + forks_url: https://api.github.com/repos/packit/ogr/forks + full_name: packit/ogr + git_commits_url: https://api.github.com/repos/packit/ogr/git/commits{/sha} + git_refs_url: https://api.github.com/repos/packit/ogr/git/refs{/sha} + git_tags_url: https://api.github.com/repos/packit/ogr/git/tags{/sha} + git_url: git://github.com/packit/ogr.git + has_downloads: true + has_issues: true + has_pages: true + has_projects: true + has_wiki: true + homepage: '' + hooks_url: https://api.github.com/repos/packit/ogr/hooks + html_url: https://github.com/packit/ogr + id: 161636700 + issue_comment_url: https://api.github.com/repos/packit/ogr/issues/comments{/number} + issue_events_url: https://api.github.com/repos/packit/ogr/issues/events{/number} + issues_url: https://api.github.com/repos/packit/ogr/issues{/number} + keys_url: https://api.github.com/repos/packit/ogr/keys{/key_id} + labels_url: https://api.github.com/repos/packit/ogr/labels{/name} + language: Python + languages_url: https://api.github.com/repos/packit/ogr/languages + license: + key: mit + name: MIT License + node_id: MDc6TGljZW5zZTEz + spdx_id: MIT + url: https://api.github.com/licenses/mit + merges_url: https://api.github.com/repos/packit/ogr/merges + milestones_url: https://api.github.com/repos/packit/ogr/milestones{/number} + mirror_url: null + name: ogr + node_id: MDEwOlJlcG9zaXRvcnkxNjE2MzY3MDA= + notifications_url: https://api.github.com/repos/packit/ogr/notifications{?since,all,participating} + open_issues: 27 + open_issues_count: 27 + owner: + avatar_url: https://avatars.githubusercontent.com/u/46870917?v=4 + events_url: https://api.github.com/users/packit/events{/privacy} + followers_url: https://api.github.com/users/packit/followers + following_url: https://api.github.com/users/packit/following{/other_user} + gists_url: https://api.github.com/users/packit/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/packit + id: 46870917 + login: packit + node_id: MDEyOk9yZ2FuaXphdGlvbjQ2ODcwOTE3 + organizations_url: https://api.github.com/users/packit/orgs + received_events_url: https://api.github.com/users/packit/received_events + repos_url: https://api.github.com/users/packit/repos + site_admin: false + starred_url: https://api.github.com/users/packit/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/packit/subscriptions + type: Organization + url: https://api.github.com/users/packit + private: false + pulls_url: https://api.github.com/repos/packit/ogr/pulls{/number} + pushed_at: '2021-06-02T13:27:10Z' + releases_url: https://api.github.com/repos/packit/ogr/releases{/id} + size: 11453 + ssh_url: git@github.com:packit/ogr.git + stargazers_count: 31 + stargazers_url: https://api.github.com/repos/packit/ogr/stargazers + statuses_url: https://api.github.com/repos/packit/ogr/statuses/{sha} + subscribers_url: https://api.github.com/repos/packit/ogr/subscribers + subscription_url: https://api.github.com/repos/packit/ogr/subscription + svn_url: https://github.com/packit/ogr + tags_url: https://api.github.com/repos/packit/ogr/tags + teams_url: https://api.github.com/repos/packit/ogr/teams + trees_url: https://api.github.com/repos/packit/ogr/git/trees{/sha} + updated_at: '2021-06-01T14:41:40Z' + url: https://api.github.com/repos/packit/ogr + watchers: 31 + watchers_count: 31 + ssh_url: git@github.com:KPostOffice/ogr.git + stargazers_count: 0 + stargazers_url: https://api.github.com/repos/KPostOffice/ogr/stargazers + statuses_url: https://api.github.com/repos/KPostOffice/ogr/statuses/{sha} + subscribers_count: 0 + subscribers_url: https://api.github.com/repos/KPostOffice/ogr/subscribers + subscription_url: https://api.github.com/repos/KPostOffice/ogr/subscription + svn_url: https://github.com/KPostOffice/ogr + tags_url: https://api.github.com/repos/KPostOffice/ogr/tags + teams_url: https://api.github.com/repos/KPostOffice/ogr/teams + temp_clone_token: '' + trees_url: https://api.github.com/repos/KPostOffice/ogr/git/trees{/sha} + updated_at: '2021-05-27T21:44:17Z' + url: https://api.github.com/repos/KPostOffice/ogr + watchers: 0 + watchers_count: 0 + _next: null + elapsed: 0.175333 + encoding: utf-8 + headers: + Access-Control-Allow-Origin: '*' + Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, + X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, + X-GitHub-Media-Type, Deprecation, Sunset + Cache-Control: private, max-age=60, s-maxage=60 + Content-Encoding: gzip + Content-Security-Policy: default-src 'none' + Content-Type: application/json; charset=utf-8 + Date: Wed, 02 Jun 2021 19:16:54 GMT + ETag: W/"d9f2d7950d57d821c2b48ba7b31a0321e1b87c40ed8745076e25defb46a17876" + Last-Modified: Thu, 27 May 2021 21:44:17 GMT + Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin + Server: GitHub.com + Strict-Transport-Security: max-age=31536000; includeSubdomains; preload + Transfer-Encoding: chunked + Vary: Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, + X-Requested-With + X-Accepted-OAuth-Scopes: repo + X-Content-Type-Options: nosniff + X-Frame-Options: deny + X-GitHub-Media-Type: github.v3; format=json + X-GitHub-Request-Id: 811C:5E3D:2B1EE8:796E5C:60B7D926 + X-OAuth-Scopes: admin:org, admin:public_key, repo, user + X-RateLimit-Limit: '5000' + X-RateLimit-Remaining: '4999' + X-RateLimit-Reset: '1622665014' + X-RateLimit-Resource: core + X-RateLimit-Used: '1' + X-XSS-Protection: '0' + raw: !!binary "" + reason: OK + status_code: 200 + https://api.github.com:443/repos/KPostOffice/ogr/issues/4: + - metadata: + latency: 0.08144879341125488 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.github.test_issues + - ogr.utils + - ogr.services.github.issue + - github.Repository + - github.Requester + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + active_lock_reason: null + assignee: null + assignees: [] + author_association: OWNER + body: '' + closed_at: null + closed_by: null + comments: 0 + comments_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/comments + created_at: '2021-05-27T21:45:01Z' + events_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/events + html_url: https://github.com/KPostOffice/ogr/issues/4 + id: 904229436 + labels: [] + labels_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/labels{/name} + locked: false + milestone: null + node_id: MDU6SXNzdWU5MDQyMjk0MzY= + number: 4 + performed_via_github_app: null + repository_url: https://api.github.com/repos/KPostOffice/ogr + state: open + title: Bang + updated_at: '2021-06-02T19:16:12Z' + url: https://api.github.com/repos/KPostOffice/ogr/issues/4 + user: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + _next: null + elapsed: 0.080601 + encoding: utf-8 + headers: + Access-Control-Allow-Origin: '*' + Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, + X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, + X-GitHub-Media-Type, Deprecation, Sunset + Cache-Control: private, max-age=60, s-maxage=60 + Content-Encoding: gzip + Content-Security-Policy: default-src 'none' + Content-Type: application/json; charset=utf-8 + Date: Wed, 02 Jun 2021 19:16:54 GMT + ETag: W/"af9a7e90687d13654de2ae0fa232f62bc248e17e8d540f6e45b779fd65bf8059" + Last-Modified: Wed, 02 Jun 2021 19:16:12 GMT + Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin + Server: GitHub.com + Strict-Transport-Security: max-age=31536000; includeSubdomains; preload + Transfer-Encoding: chunked + Vary: Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, + X-Requested-With + X-Accepted-OAuth-Scopes: repo + X-Content-Type-Options: nosniff + X-Frame-Options: deny + X-GitHub-Media-Type: github.v3; format=json + X-GitHub-Request-Id: 811C:5E3D:2B1EF5:796E81:60B7D926 + X-OAuth-Scopes: admin:org, admin:public_key, repo, user + X-RateLimit-Limit: '5000' + X-RateLimit-Remaining: '4998' + X-RateLimit-Reset: '1622665014' + X-RateLimit-Resource: core + X-RateLimit-Used: '2' + X-XSS-Protection: '0' + raw: !!binary "" + reason: OK + status_code: 200 + - metadata: + latency: 0.08562159538269043 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.github.test_issues + - ogr.utils + - ogr.services.github.issue + - github.Repository + - github.Requester + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + active_lock_reason: null + assignee: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + assignees: + - avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + author_association: OWNER + body: '' + closed_at: null + closed_by: null + comments: 0 + comments_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/comments + created_at: '2021-05-27T21:45:01Z' + events_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/events + html_url: https://github.com/KPostOffice/ogr/issues/4 + id: 904229436 + labels: [] + labels_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/labels{/name} + locked: false + milestone: null + node_id: MDU6SXNzdWU5MDQyMjk0MzY= + number: 4 + performed_via_github_app: null + repository_url: https://api.github.com/repos/KPostOffice/ogr + state: open + title: Bang + updated_at: '2021-06-02T19:16:54Z' + url: https://api.github.com/repos/KPostOffice/ogr/issues/4 + user: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + _next: null + elapsed: 0.085399 + encoding: utf-8 + headers: + Access-Control-Allow-Origin: '*' + Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, + X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, + X-GitHub-Media-Type, Deprecation, Sunset + Cache-Control: private, max-age=60, s-maxage=60 + Content-Encoding: gzip + Content-Security-Policy: default-src 'none' + Content-Type: application/json; charset=utf-8 + Date: Wed, 02 Jun 2021 19:16:54 GMT + ETag: W/"c44497b283bb598520cb707a88196147a92a450a15e31b85030c044431d68445" + Last-Modified: Wed, 02 Jun 2021 19:16:54 GMT + Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin + Server: GitHub.com + Strict-Transport-Security: max-age=31536000; includeSubdomains; preload + Transfer-Encoding: chunked + Vary: Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, + X-Requested-With + X-Accepted-OAuth-Scopes: repo + X-Content-Type-Options: nosniff + X-Frame-Options: deny + X-GitHub-Media-Type: github.v3; format=json + X-GitHub-Request-Id: 811C:5E3D:2B1F25:796EFF:60B7D926 + X-OAuth-Scopes: admin:org, admin:public_key, repo, user + X-RateLimit-Limit: '5000' + X-RateLimit-Remaining: '4995' + X-RateLimit-Reset: '1622665014' + X-RateLimit-Resource: core + X-RateLimit-Used: '5' + X-XSS-Protection: '0' + raw: !!binary "" + reason: OK + status_code: 200 + https://api.github.com:443/user: + - metadata: + latency: 0.13141632080078125 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.github.test_issues + - ogr.services.github.user + - github.AuthenticatedUser + - github.GithubObject + - github.Requester + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + bio: null + blog: '' + collaborators: 3 + company: Red Hat + created_at: '2016-03-03T19:26:46Z' + disk_usage: 133440 + email: kpostlet@redhat.com + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers: 7 + followers_url: https://api.github.com/users/KPostOffice/followers + following: 3 + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + hireable: null + html_url: https://github.com/KPostOffice + id: 17623061 + location: Boston + login: KPostOffice + name: null + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + owned_private_repos: 8 + plan: + collaborators: 0 + name: free + private_repos: 10000 + space: 976562499 + private_gists: 0 + public_gists: 4 + public_repos: 77 + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + total_private_repos: 9 + twitter_username: null + two_factor_authentication: true + type: User + updated_at: '2021-06-01T17:19:41Z' + url: https://api.github.com/users/KPostOffice + _next: null + elapsed: 0.131189 + encoding: utf-8 + headers: + Access-Control-Allow-Origin: '*' + Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, + X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, + X-GitHub-Media-Type, Deprecation, Sunset + Cache-Control: private, max-age=60, s-maxage=60 + Content-Encoding: gzip + Content-Security-Policy: default-src 'none' + Content-Type: application/json; charset=utf-8 + Date: Wed, 02 Jun 2021 19:16:54 GMT + ETag: W/"10b79aac39facb28d024a4ff7e7fc2fc4e2516b8834f268094df414047883c23" + Last-Modified: Tue, 01 Jun 2021 17:19:41 GMT + Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin + Server: GitHub.com + Strict-Transport-Security: max-age=31536000; includeSubdomains; preload + Transfer-Encoding: chunked + Vary: Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, + X-Requested-With + X-Accepted-OAuth-Scopes: '' + X-Content-Type-Options: nosniff + X-Frame-Options: deny + X-GitHub-Media-Type: github.v3; format=json + X-GitHub-Request-Id: 811E:5935:33EDB3:65DF68:60B7D926 + X-OAuth-Scopes: admin:org, admin:public_key, repo, user + X-RateLimit-Limit: '5000' + X-RateLimit-Remaining: '4997' + X-RateLimit-Reset: '1622665014' + X-RateLimit-Resource: core + X-RateLimit-Used: '3' + X-XSS-Protection: '0' + raw: !!binary "" + reason: OK + status_code: 200 + PATCH: + https://api.github.com:443/repos/KPostOffice/ogr/issues/4: + - metadata: + latency: 0.3234868049621582 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.github.test_issues + - ogr.services.github.issue + - github.Issue + - github.Requester + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + active_lock_reason: null + assignee: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + assignees: + - avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + author_association: OWNER + body: '' + closed_at: null + closed_by: null + comments: 0 + comments_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/comments + created_at: '2021-05-27T21:45:01Z' + events_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/events + html_url: https://github.com/KPostOffice/ogr/issues/4 + id: 904229436 + labels: [] + labels_url: https://api.github.com/repos/KPostOffice/ogr/issues/4/labels{/name} + locked: false + milestone: null + node_id: MDU6SXNzdWU5MDQyMjk0MzY= + number: 4 + performed_via_github_app: null + repository_url: https://api.github.com/repos/KPostOffice/ogr + state: open + title: Bang + updated_at: '2021-06-02T19:16:54Z' + url: https://api.github.com/repos/KPostOffice/ogr/issues/4 + user: + avatar_url: https://avatars.githubusercontent.com/u/17623061?v=4 + events_url: https://api.github.com/users/KPostOffice/events{/privacy} + followers_url: https://api.github.com/users/KPostOffice/followers + following_url: https://api.github.com/users/KPostOffice/following{/other_user} + gists_url: https://api.github.com/users/KPostOffice/gists{/gist_id} + gravatar_id: '' + html_url: https://github.com/KPostOffice + id: 17623061 + login: KPostOffice + node_id: MDQ6VXNlcjE3NjIzMDYx + organizations_url: https://api.github.com/users/KPostOffice/orgs + received_events_url: https://api.github.com/users/KPostOffice/received_events + repos_url: https://api.github.com/users/KPostOffice/repos + site_admin: false + starred_url: https://api.github.com/users/KPostOffice/starred{/owner}{/repo} + subscriptions_url: https://api.github.com/users/KPostOffice/subscriptions + type: User + url: https://api.github.com/users/KPostOffice + _next: null + elapsed: 0.323245 + encoding: utf-8 + headers: + Access-Control-Allow-Origin: '*' + Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, + X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, + X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, + X-GitHub-Media-Type, Deprecation, Sunset + Cache-Control: private, max-age=60, s-maxage=60 + Content-Encoding: gzip + Content-Security-Policy: default-src 'none' + Content-Type: application/json; charset=utf-8 + Date: Wed, 02 Jun 2021 19:16:54 GMT + ETag: W/"c44497b283bb598520cb707a88196147a92a450a15e31b85030c044431d68445" + Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin + Server: GitHub.com + Strict-Transport-Security: max-age=31536000; includeSubdomains; preload + Transfer-Encoding: chunked + Vary: Accept, Authorization, Cookie, X-GitHub-OTP, Accept-Encoding, Accept, + X-Requested-With + X-Accepted-OAuth-Scopes: '' + X-Content-Type-Options: nosniff + X-Frame-Options: deny + X-GitHub-Media-Type: github.v3; format=json + X-GitHub-Request-Id: 811C:5E3D:2B1F0C:796EB9:60B7D926 + X-OAuth-Scopes: admin:org, admin:public_key, repo, user + X-RateLimit-Limit: '5000' + X-RateLimit-Remaining: '4996' + X-RateLimit-Reset: '1622665014' + X-RateLimit-Resource: core + X-RateLimit-Used: '4' + X-XSS-Protection: '0' + raw: !!binary "" + reason: OK + status_code: 200 diff --git a/tests/integration/github/test_issues.py b/tests/integration/github/test_issues.py index fefe5b5d..c500bd22 100644 --- a/tests/integration/github/test_issues.py +++ b/tests/integration/github/test_issues.py @@ -110,6 +110,22 @@ def test_issue_labels(self): assert labels[0].name == "test_lb1" assert labels[1].name == "test_lb2" + def test_issue_assignees(self): + """ + Remove the assignees from this issue before regenerating the response files: + https://github.com/packit/ogr/issues/4 + """ + project = self.service.get_project(repo="ogr", namespace="KPostOffice") + issue = project.get_issue(4) + print(self.service.user.get_username()) + assignees = issue.assignees + + assert not assignees + issue.add_assignee("KPostOffice") + assignees = project.get_issue(4).assignees + assert len(assignees) == 1 + assert assignees[0].login == "KPostOffice" + def test_list_contains_only_issues(self): issue_list_all = self.ogr_project.get_issue_list(status=IssueStatus.all) issue_ids = [issue.id for issue in issue_list_all] diff --git a/tests/integration/gitlab/test_data/test_issues/Issues.test_issue_assignees.yaml b/tests/integration/gitlab/test_data/test_issues/Issues.test_issue_assignees.yaml new file mode 100644 index 00000000..1c75948a --- /dev/null +++ b/tests/integration/gitlab/test_data/test_issues/Issues.test_issue_assignees.yaml @@ -0,0 +1,688 @@ +_requre: + DataTypes: 1 + key_strategy: StorageKeysInspectSimple + version_storage_file: 3 +requests.sessions: + send: + GET: + https://gitlab.com/api/v4/projects/26978624/issues/1: + - metadata: + latency: 0.39066386222839355 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_issues + - ogr.utils + - ogr.services.gitlab.issue + - gitlab.exceptions + - gitlab.mixins + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + _links: + award_emoji: https://gitlab.com/api/v4/projects/26978624/issues/1/award_emoji + notes: https://gitlab.com/api/v4/projects/26978624/issues/1/notes + project: https://gitlab.com/api/v4/projects/26978624 + self: https://gitlab.com/api/v4/projects/26978624/issues/1 + assignee: null + assignees: [] + author: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + blocking_issues_count: 0 + closed_at: null + closed_by: null + confidential: false + created_at: '2021-05-27T22:01:38.343Z' + description: '' + discussion_locked: null + downvotes: 0 + due_date: null + has_tasks: false + health_status: null + id: 87841611 + iid: 1 + issue_type: issue + labels: [] + merge_requests_count: 0 + milestone: null + moved_to_id: null + project_id: 26978624 + references: + full: kpostlet/ogr-tests#1 + relative: '#1' + short: '#1' + service_desk_reply_to: null + state: opened + subscribed: true + 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: foobar + type: ISSUE + updated_at: '2021-06-02T19:47:12.621Z' + upvotes: 0 + user_notes_count: 0 + web_url: https://gitlab.com/kpostlet/ogr-tests/-/issues/1 + weight: null + _next: null + elapsed: 0.389974 + encoding: null + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 65933638bec15e89-IAD + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:50:38 GMT + Etag: W/"7106034220985b616773acbb9880a50f" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-04-lb-gprd + GitLab-SV: api-gke-us-east1-c + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: issue_tracking + X-Request-Id: 01F774E7XQF1W1M0K6DK75DBMP + X-Runtime: '0.072558' + cf-request-id: 0a6fe0377500005e89748dd000000001 + raw: !!binary "" + reason: OK + status_code: 200 + - metadata: + latency: 0.7731468677520752 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_issues + - ogr.utils + - ogr.services.gitlab.issue + - gitlab.exceptions + - gitlab.mixins + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + _links: + award_emoji: https://gitlab.com/api/v4/projects/26978624/issues/1/award_emoji + notes: https://gitlab.com/api/v4/projects/26978624/issues/1/notes + project: https://gitlab.com/api/v4/projects/26978624 + self: https://gitlab.com/api/v4/projects/26978624/issues/1 + assignee: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + assignees: + - avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + author: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + blocking_issues_count: 0 + closed_at: null + closed_by: null + confidential: false + created_at: '2021-05-27T22:01:38.343Z' + description: '' + discussion_locked: null + downvotes: 0 + due_date: null + has_tasks: false + health_status: null + id: 87841611 + iid: 1 + issue_type: issue + labels: [] + merge_requests_count: 0 + milestone: null + moved_to_id: null + project_id: 26978624 + references: + full: kpostlet/ogr-tests#1 + relative: '#1' + short: '#1' + service_desk_reply_to: null + state: opened + subscribed: true + 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: foobar + type: ISSUE + updated_at: '2021-06-02T19:50:38.989Z' + upvotes: 0 + user_notes_count: 0 + web_url: https://gitlab.com/kpostlet/ogr-tests/-/issues/1 + weight: null + _next: null + elapsed: 0.772707 + encoding: null + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6593363f49355e89-IAD + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:50:39 GMT + Etag: W/"226387f14f35d3f3d0bdbe5a7db1482f" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-09-lb-gprd + GitLab-SV: gke-cny-api + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: issue_tracking + X-Request-Id: 01F774E8Y8V87N4WVVARM2X6NK + X-Runtime: '0.295147' + cf-request-id: 0a6fe03b9000005e89661c7000000001 + raw: !!binary "" + reason: OK + status_code: 200 + https://gitlab.com/api/v4/projects/kpostlet%2Fogr-tests: + - metadata: + latency: 0.40716123580932617 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_issues + - ogr.utils + - ogr.services.gitlab.issue + - 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/26978624/events + issues: https://gitlab.com/api/v4/projects/26978624/issues + labels: https://gitlab.com/api/v4/projects/26978624/labels + members: https://gitlab.com/api/v4/projects/26978624/members + merge_requests: https://gitlab.com/api/v4/projects/26978624/merge_requests + repo_branches: https://gitlab.com/api/v4/projects/26978624/repository/branches + self: https://gitlab.com/api/v4/projects/26978624 + 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: true + compliance_frameworks: [] + container_expiration_policy: + cadence: 1d + enabled: false + keep_n: 10 + name_regex: .* + name_regex_keep: null + next_run_at: '2021-05-28T21:56:21.432Z' + older_than: 90d + container_registry_enabled: true + container_registry_image_prefix: registry.gitlab.com/kpostlet/ogr-tests + created_at: '2021-05-27T21:56:21.408Z' + creator_id: 8919946 + 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: '' + forked_from_project: + avatar_url: null + created_at: '2019-09-10T10:28:09.946Z' + default_branch: master + description: Testing repository for python-ogr package. | https://github.com/packit-service/ogr + forks_count: 7 + http_url_to_repo: https://gitlab.com/packit-service/ogr-tests.git + id: 14233409 + last_activity_at: '2021-04-27T07:13:35.566Z' + 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 + path: ogr-tests + path_with_namespace: packit-service/ogr-tests + readme_url: https://gitlab.com/packit-service/ogr-tests/-/blob/master/README.md + ssh_url_to_repo: git@gitlab.com:packit-service/ogr-tests.git + star_count: 0 + tag_list: [] + web_url: https://gitlab.com/packit-service/ogr-tests + forking_access_level: enabled + forks_count: 0 + http_url_to_repo: https://gitlab.com/kpostlet/ogr-tests.git + id: 26978624 + import_error: null + import_status: finished + issues_access_level: enabled + issues_enabled: true + issues_template: null + jobs_enabled: true + last_activity_at: '2021-05-27T21:56:21.408Z' + 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: Kevin Postlethwait / ogr-tests + namespace: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + full_path: kpostlet + id: 12115824 + kind: user + name: Kevin Postlethwait + parent_id: null + path: kpostlet + web_url: https://gitlab.com/kpostlet + only_allow_merge_if_all_discussions_are_resolved: false + only_allow_merge_if_pipeline_succeeds: false + open_issues_count: 1 + operations_access_level: enabled + owner: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + packages_enabled: true + pages_access_level: enabled + path: ogr-tests + path_with_namespace: kpostlet/ogr-tests + permissions: + group_access: null + project_access: + access_level: 40 + notification_level: 3 + printing_merge_request_link_enabled: true + public_jobs: true + readme_url: https://gitlab.com/kpostlet/ogr-tests/-/blob/master/README.md + remove_source_branch_after_merge: true + repository_access_level: enabled + request_access_enabled: true + requirements_enabled: true + resolve_outdated_diff_discussions: false + restrict_user_defined_variables: false + runners_token: gwuso9y7a_v9enu6T2Gx + security_and_compliance_enabled: true + service_desk_address: incoming+kpostlet-ogr-tests-26978624-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:kpostlet/ogr-tests.git + star_count: 0 + suggestion_commit_message: null + tag_list: [] + visibility: public + web_url: https://gitlab.com/kpostlet/ogr-tests + wiki_access_level: enabled + wiki_enabled: true + _next: null + elapsed: 0.406173 + encoding: null + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 659336361af95e89-IAD + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:50:38 GMT + Etag: W/"9d2ab448298218ef9ba105d38aad84f1" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-05-lb-gprd + GitLab-SV: api-gke-us-east1-d + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: projects + X-Request-Id: 01F774E7GHNKKJXXSSXZF9R41K + X-Runtime: '0.136618' + cf-request-id: 0a6fe035cb00005e8977a7f000000001 + raw: !!binary "" + reason: OK + status_code: 200 + https://gitlab.com/api/v4/user: + - metadata: + latency: 0.3278024196624756 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_issues + - ogr.utils + - ogr.services.gitlab.issue + - 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/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + bio: '' + bio_html: '' + bot: false + can_create_group: true + can_create_project: true + color_scheme_id: 1 + commit_email: kpostlet@redhat.com + confirmed_at: '2021-05-18T18:21:49.438Z' + created_at: '2021-05-18T18:21:49.501Z' + current_sign_in_at: '2021-05-27T21:56:05.406Z' + email: kpostlet@redhat.com + external: false + extra_shared_runners_minutes_limit: null + followers: 0 + following: 0 + id: 8919946 + identities: + - extern_uid: '102547849534309033904' + provider: google_oauth2 + saml_provider_id: null + job_title: '' + last_activity_on: '2021-06-02' + last_sign_in_at: '2021-05-18T18:21:49.570Z' + linkedin: '' + location: null + name: Kevin Postlethwait + organization: null + private_profile: false + projects_limit: 100000 + public_email: '' + shared_runners_minutes_limit: null + skype: '' + state: active + theme_id: 1 + twitter: '' + two_factor_enabled: false + username: kpostlet + web_url: https://gitlab.com/kpostlet + website_url: '' + work_information: null + _next: null + elapsed: 0.32762 + encoding: null + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6593363458a15e89-IAD + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:50:37 GMT + Etag: W/"d571862a01b82de7cad1394e49171104" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-11-lb-gprd + GitLab-SV: api-gke-us-east1-d + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: users + X-Request-Id: 01F774E77YXVD3CRYFZWR5CXA5 + X-Runtime: '0.034922' + cf-request-id: 0a6fe034b700005e89ad29e000000001 + raw: !!binary "" + reason: OK + status_code: 200 + https://gitlab.com/api/v4/users?username=kpostlet: + - metadata: + latency: 0.1709280014038086 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_issues + - ogr.services.gitlab.issue + - 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/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + _next: null + elapsed: 0.170004 + encoding: null + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6593363b3afd5e89-IAD + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:50:38 GMT + Etag: W/"c89cafa722673e5a7a589a3adfd452fc" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-04-lb-gprd + GitLab-SV: api-gke-us-east1-c + Link: ; + rel="first", ; + rel="last" + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: users + X-Next-Page: '' + X-Page: '1' + X-Per-Page: '20' + X-Prev-Page: '' + X-Request-Id: 01F774E8BATHQCVDVFWNRM66M2 + X-Runtime: '0.031121' + X-Total: '1' + X-Total-Pages: '1' + cf-request-id: 0a6fe0390800005e8971904000000001 + raw: !!binary "" + reason: OK + status_code: 200 + PUT: + https://gitlab.com/api/v4/projects/26978624/issues/1: + - metadata: + latency: 0.45549964904785156 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.gitlab.test_issues + - ogr.services.gitlab.issue + - gitlab.mixins + - gitlab.exceptions + - gitlab.mixins + - gitlab.client + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + _links: + award_emoji: https://gitlab.com/api/v4/projects/26978624/issues/1/award_emoji + notes: https://gitlab.com/api/v4/projects/26978624/issues/1/notes + project: https://gitlab.com/api/v4/projects/26978624 + self: https://gitlab.com/api/v4/projects/26978624/issues/1 + assignee: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + assignees: + - avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + author: + avatar_url: https://secure.gravatar.com/avatar/1804053228f97cb0eaa23d9a87054c40?s=80&d=identicon + id: 8919946 + name: Kevin Postlethwait + state: active + username: kpostlet + web_url: https://gitlab.com/kpostlet + blocking_issues_count: 0 + closed_at: null + closed_by: null + confidential: false + created_at: '2021-05-27T22:01:38.343Z' + description: '' + discussion_locked: null + downvotes: 0 + due_date: null + has_tasks: false + health_status: null + id: 87841611 + iid: 1 + issue_type: issue + labels: [] + merge_requests_count: 0 + milestone: null + moved_to_id: null + project_id: 26978624 + references: + full: kpostlet/ogr-tests#1 + relative: '#1' + short: '#1' + service_desk_reply_to: null + state: opened + subscribed: true + 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: foobar + type: ISSUE + updated_at: '2021-06-02T19:50:38.989Z' + upvotes: 0 + user_notes_count: 0 + web_url: https://gitlab.com/kpostlet/ogr-tests/-/issues/1 + weight: null + _next: null + elapsed: 0.454809 + encoding: null + headers: + CF-Cache-Status: DYNAMIC + CF-RAY: 6593363c6cb35e89-IAD + Cache-Control: max-age=0, private, must-revalidate + Connection: keep-alive + Content-Encoding: gzip + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:50:39 GMT + Etag: W/"226387f14f35d3f3d0bdbe5a7db1482f" + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + GitLab-LB: fe-03-lb-gprd + GitLab-SV: api-gke-us-east1-b + Referrer-Policy: strict-origin-when-cross-origin + Server: cloudflare + Strict-Transport-Security: max-age=31536000 + Transfer-Encoding: chunked + Vary: Origin + X-Content-Type-Options: nosniff + X-Frame-Options: SAMEORIGIN + X-Gitlab-Feature-Category: issue_tracking + X-Request-Id: 01F774E8JWRS98ZGG21GVBSHN9 + X-Runtime: '0.247808' + cf-request-id: 0a6fe039bc00005e89ae2c8000000001 + raw: !!binary "" + reason: OK + status_code: 200 diff --git a/tests/integration/gitlab/test_issues.py b/tests/integration/gitlab/test_issues.py index 90c07499..79931599 100644 --- a/tests/integration/gitlab/test_issues.py +++ b/tests/integration/gitlab/test_issues.py @@ -143,6 +143,21 @@ def test_issue_labels(self): assert labels[0] == "test_lb1" assert labels[1] == "test_lb2" + def test_issue_assignees(self): + """ + Remove the assignees from this issue before regenerating the response files: + https://github.com/packit-service/ogr-tests/issues/1 + """ + project = self.service.get_project(repo="ogr-tests", namespace="kpostlet") + issue = project.get_issue(1) + assignees = issue.assignees + + assert not assignees + issue.add_assignee("kpostlet") + assignees = project.get_issue(1).assignees + assert len(assignees) == 1 + assert assignees[0]["username"] == "kpostlet" + def test_issue_list_labels(self): issue_list = self.project.get_issue_list( status=IssueStatus.all, labels=["testing-label-for-test-issue-list-labels"] diff --git a/tests/integration/pagure/test_data/test_issues/Issues.test_issue_assignees.yaml b/tests/integration/pagure/test_data/test_issues/Issues.test_issue_assignees.yaml new file mode 100644 index 00000000..cd5d4f77 --- /dev/null +++ b/tests/integration/pagure/test_data/test_issues/Issues.test_issue_assignees.yaml @@ -0,0 +1,410 @@ +_requre: + DataTypes: 1 + key_strategy: StorageKeysInspectSimple + version_storage_file: 3 +requests.sessions: + send: + GET: + https://pagure.io/api/0/fork/kpostlet/testing/hello-112111/issue/4: + - metadata: + latency: 0.4468674659729004 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.pagure.test_issues + - ogr.utils + - ogr.services.pagure.issue + - ogr.services.pagure.project + - ogr.services.pagure.service + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + assignee: null + blocks: [] + close_status: null + closed_at: null + closed_by: null + comments: + - comment: '**Metadata Update from @kpostlet**: + + - Issue assigned to kpostlet' + date_created: '1622590693' + edited_on: null + editor: null + id: 735700 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + - comment: '**Metadata Update from @kpostlet**: + + - Assignee reset' + date_created: '1622661392' + edited_on: null + editor: null + id: 735907 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + content: zoom + custom_fields: [] + date_created: '1622153449' + depends: [] + full_url: https://pagure.io/fork/kpostlet/testing/hello-112111/issue/4 + id: 4 + last_updated: '1622661392' + milestone: null + priority: null + private: false + related_prs: [] + status: Open + tags: [] + title: For integration + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + _next: null + elapsed: 0.445934 + encoding: null + headers: + Connection: Keep-Alive + Content-Length: '1601' + Content-Security-Policy: default-src 'self';script-src 'self' 'nonce-2I8U3ZMBCF5m3Vpd7YZPkUWgs'; + style-src 'self' 'nonce-2I8U3ZMBCF5m3Vpd7YZPkUWgs'; object-src 'none';base-uri + 'self';img-src 'self' https:;connect-src 'self' https://pagure.io:8088;frame-src + https://docs.pagure.org;frame-ancestors https://pagure.io; + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:20:49 GMT + Keep-Alive: timeout=5, max=99 + Referrer-Policy: same-origin + Server: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1g mod_wsgi/4.6.4 + Python/3.6 + Set-Cookie: pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiYzk4OTUwMGQ1ZjU2ZGM2NWY0ODBiNmI4YTVkOGYyYThkMzFlN2UyZSJ9.E5lrkQ.33bAef_Q_OpfRk4DT2NWZqJ9VLk; + Expires=Sat, 03-Jul-2021 19:20:49 GMT; Secure; HttpOnly; Path=/ + Strict-Transport-Security: max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: nosniff + X-Frame-Options: ALLOW-FROM https://pagure.io/ + X-Xss-Protection: 1; mode=block + raw: !!binary "" + reason: OK + status_code: 200 + - metadata: + latency: 4.89373779296875 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.pagure.test_issues + - ogr.utils + - ogr.services.pagure.issue + - ogr.services.pagure.project + - ogr.services.pagure.service + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + assignee: null + blocks: [] + close_status: null + closed_at: null + closed_by: null + comments: + - comment: '**Metadata Update from @kpostlet**: + + - Issue assigned to kpostlet' + date_created: '1622590693' + edited_on: null + editor: null + id: 735700 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + - comment: '**Metadata Update from @kpostlet**: + + - Assignee reset' + date_created: '1622661392' + edited_on: null + editor: null + id: 735907 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + content: zoom + custom_fields: [] + date_created: '1622153449' + depends: [] + full_url: https://pagure.io/fork/kpostlet/testing/hello-112111/issue/4 + id: 4 + last_updated: '1622661392' + milestone: null + priority: null + private: false + related_prs: [] + status: Open + tags: [] + title: For integration + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + _next: null + elapsed: 4.892653 + encoding: null + headers: + Connection: Keep-Alive + Content-Length: '1601' + Content-Security-Policy: default-src 'self';script-src 'self' 'nonce-QVQMGeQTmwP6MNzDu4UjnP7B2'; + style-src 'self' 'nonce-QVQMGeQTmwP6MNzDu4UjnP7B2'; object-src 'none';base-uri + 'self';img-src 'self' https:;connect-src 'self' https://pagure.io:8088;frame-src + https://docs.pagure.org;frame-ancestors https://pagure.io; + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:20:50 GMT + Keep-Alive: timeout=5, max=98 + Referrer-Policy: same-origin + Server: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1g mod_wsgi/4.6.4 + Python/3.6 + Set-Cookie: pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiYzk4OTUwMGQ1ZjU2ZGM2NWY0ODBiNmI4YTVkOGYyYThkMzFlN2UyZSJ9.E5lrlg.5lDHFF1cT-P5qFjh3k_lMp8ros0; + Expires=Sat, 03-Jul-2021 19:20:54 GMT; Secure; HttpOnly; Path=/ + Strict-Transport-Security: max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: nosniff + X-Frame-Options: ALLOW-FROM https://pagure.io/ + X-Xss-Protection: 1; mode=block + raw: !!binary "" + reason: OK + status_code: 200 + - metadata: + latency: 0.36761021614074707 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.pagure.test_issues + - ogr.utils + - ogr.services.pagure.issue + - ogr.services.pagure.project + - ogr.services.pagure.service + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + assignee: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + blocks: [] + close_status: null + closed_at: null + closed_by: null + comments: + - comment: '**Metadata Update from @kpostlet**: + + - Issue assigned to kpostlet' + date_created: '1622590693' + edited_on: null + editor: null + id: 735700 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + - comment: '**Metadata Update from @kpostlet**: + + - Assignee reset' + date_created: '1622661392' + edited_on: null + editor: null + id: 735907 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + - comment: '**Metadata Update from @kpostlet**: + + - Issue assigned to kpostlet' + date_created: '1622661655' + edited_on: null + editor: null + id: 735918 + notification: true + parent: null + reactions: {} + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + content: zoom + custom_fields: [] + date_created: '1622153449' + depends: [] + full_url: https://pagure.io/fork/kpostlet/testing/hello-112111/issue/4 + id: 4 + last_updated: '1622661655' + milestone: null + priority: null + private: false + related_prs: [] + status: Open + tags: [] + title: For integration + user: + full_url: https://pagure.io/user/kpostlet + fullname: Kevin Postlethwait + name: kpostlet + url_path: user/kpostlet + _next: null + elapsed: 0.367278 + encoding: null + headers: + Connection: Keep-Alive + Content-Length: '2222' + Content-Security-Policy: default-src 'self';script-src 'self' 'nonce-pYikKSWONeP7fFeAEoJy1YmjO'; + style-src 'self' 'nonce-pYikKSWONeP7fFeAEoJy1YmjO'; object-src 'none';base-uri + 'self';img-src 'self' https:;connect-src 'self' https://pagure.io:8088;frame-src + https://docs.pagure.org;frame-ancestors https://pagure.io; + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:20:55 GMT + Keep-Alive: timeout=5, max=96 + Referrer-Policy: same-origin + Server: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1g mod_wsgi/4.6.4 + Python/3.6 + Set-Cookie: pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiYzk4OTUwMGQ1ZjU2ZGM2NWY0ODBiNmI4YTVkOGYyYThkMzFlN2UyZSJ9.E5lrlw.HPHf2VY62-IjvEZ0jvM03hocDdY; + Expires=Sat, 03-Jul-2021 19:20:55 GMT; Secure; HttpOnly; Path=/ + Strict-Transport-Security: max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: nosniff + X-Frame-Options: ALLOW-FROM https://pagure.io/ + X-Xss-Protection: 1; mode=block + raw: !!binary "" + reason: OK + status_code: 200 + POST: + https://pagure.io/api/0/-/whoami: + - metadata: + latency: 0.16333818435668945 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.pagure.test_issues + - ogr.services.pagure.service + - ogr.services.pagure.user + - ogr.services.pagure.service + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + username: kpostlet + _next: null + elapsed: 0.16298 + encoding: null + headers: + Connection: Keep-Alive + Content-Length: '29' + Content-Security-Policy: default-src 'self';script-src 'self' 'nonce-hfV9vj4ddEMiu5BJvW6H5Ep6v'; + style-src 'self' 'nonce-hfV9vj4ddEMiu5BJvW6H5Ep6v'; object-src 'none';base-uri + 'self';img-src 'self' https:;connect-src 'self' https://pagure.io:8088;frame-src + https://docs.pagure.org;frame-ancestors https://pagure.io; + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:20:49 GMT + Keep-Alive: timeout=5, max=100 + Referrer-Policy: same-origin + Server: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1g mod_wsgi/4.6.4 + Python/3.6 + Set-Cookie: pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiYzk4OTUwMGQ1ZjU2ZGM2NWY0ODBiNmI4YTVkOGYyYThkMzFlN2UyZSJ9.E5lrkQ.33bAef_Q_OpfRk4DT2NWZqJ9VLk; + Expires=Sat, 03-Jul-2021 19:20:49 GMT; Secure; HttpOnly; Path=/ + Strict-Transport-Security: max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: nosniff + X-Frame-Options: ALLOW-FROM https://pagure.io/ + X-Xss-Protection: 1; mode=block + raw: !!binary "" + reason: OK + status_code: 200 + https://pagure.io/api/0/fork/kpostlet/testing/hello-112111/issue/4/assign: + - metadata: + latency: 0.5392651557922363 + module_call_list: + - unittest.case + - requre.online_replacing + - tests.integration.pagure.test_issues + - ogr.services.pagure.issue + - ogr.services.pagure.project + - ogr.services.pagure.service + - requests.sessions + - requre.objects + - requre.cassette + - requests.sessions + - send + output: + __store_indicator: 2 + _content: + message: Issue assigned to kpostlet + _next: null + elapsed: 0.538328 + encoding: null + headers: + Connection: Keep-Alive + Content-Length: '46' + Content-Security-Policy: default-src 'self';script-src 'self' 'nonce-X6OawqT252Bu1F6TaeoAw91PP'; + style-src 'self' 'nonce-X6OawqT252Bu1F6TaeoAw91PP'; object-src 'none';base-uri + 'self';img-src 'self' https:;connect-src 'self' https://pagure.io:8088;frame-src + https://docs.pagure.org;frame-ancestors https://pagure.io; + Content-Type: application/json + Date: Wed, 02 Jun 2021 19:20:54 GMT + Keep-Alive: timeout=5, max=97 + Referrer-Policy: same-origin + Server: Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1g mod_wsgi/4.6.4 + Python/3.6 + Set-Cookie: pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiYzk4OTUwMGQ1ZjU2ZGM2NWY0ODBiNmI4YTVkOGYyYThkMzFlN2UyZSJ9.E5lrlw.HPHf2VY62-IjvEZ0jvM03hocDdY; + Expires=Sat, 03-Jul-2021 19:20:55 GMT; Secure; HttpOnly; Path=/ + Strict-Transport-Security: max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: nosniff + X-Frame-Options: ALLOW-FROM https://pagure.io/ + X-Xss-Protection: 1; mode=block + raw: !!binary "" + reason: OK + status_code: 200 diff --git a/tests/integration/pagure/test_issues.py b/tests/integration/pagure/test_issues.py index b508c102..1a05d7fa 100644 --- a/tests/integration/pagure/test_issues.py +++ b/tests/integration/pagure/test_issues.py @@ -84,6 +84,22 @@ def test_create_issue_with_assignees(self): assert issue.description == random_str assert issue.assignee == assignee[0] + def test_issue_assignees(self): + """ + Remove the assignees from this issue before regenerating the response files: + https://pagure.io/testing/hello-112111/issue/4 + """ + + project = self.service.get_project( + repo="hello-112111", namespace="testing", is_fork=True + ) + issue = project.get_issue(4) + + assert not project.get_issue(4).assignee + issue.add_assignee("kpostlet") + assignee = project.get_issue(4).assignee + assert assignee == "kpostlet" + def test_issue_without_label(self): title = "This is an issue" description = "Example of Issue description"