integrations: Add issue demilestoned fixture to GitHub Integration.

This commit is contained in:
Satyam Bansal
2023-06-10 17:12:55 +05:30
committed by Tim Abbott
parent f8ac308ec2
commit 1c567ae616
2 changed files with 266 additions and 0 deletions

View File

@@ -0,0 +1,260 @@
{
"action": "demilestoned",
"issue": {
"url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/6",
"repository_url": "https://api.github.com/repos/sbansal1999/testing-gh",
"labels_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/6/labels{/name}",
"comments_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/6/comments",
"events_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/6/events",
"html_url": "https://github.com/sbansal1999/testing-gh/issues/6",
"id": 1651034453,
"node_id": "I_kwDOJRp_V85iaMlV",
"number": 6,
"title": "This is a sample issue to test GH Integration Func",
"user": {
"login": "sbansal1999",
"id": 35286603,
"node_id": "MDQ6VXNlcjM1Mjg2NjAz",
"avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sbansal1999",
"html_url": "https://github.com/sbansal1999",
"followers_url": "https://api.github.com/users/sbansal1999/followers",
"following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
"gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
"organizations_url": "https://api.github.com/users/sbansal1999/orgs",
"repos_url": "https://api.github.com/users/sbansal1999/repos",
"events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
"received_events_url": "https://api.github.com/users/sbansal1999/received_events",
"type": "User",
"site_admin": false
},
"labels": [],
"state": "open",
"locked": false,
"assignee": {
"login": "sbansal1999",
"id": 35286603,
"node_id": "MDQ6VXNlcjM1Mjg2NjAz",
"avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sbansal1999",
"html_url": "https://github.com/sbansal1999",
"followers_url": "https://api.github.com/users/sbansal1999/followers",
"following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
"gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
"organizations_url": "https://api.github.com/users/sbansal1999/orgs",
"repos_url": "https://api.github.com/users/sbansal1999/repos",
"events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
"received_events_url": "https://api.github.com/users/sbansal1999/received_events",
"type": "User",
"site_admin": false
},
"assignees": [
{
"login": "sbansal1999",
"id": 35286603,
"node_id": "MDQ6VXNlcjM1Mjg2NjAz",
"avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sbansal1999",
"html_url": "https://github.com/sbansal1999",
"followers_url": "https://api.github.com/users/sbansal1999/followers",
"following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
"gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
"organizations_url": "https://api.github.com/users/sbansal1999/orgs",
"repos_url": "https://api.github.com/users/sbansal1999/repos",
"events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
"received_events_url": "https://api.github.com/users/sbansal1999/received_events",
"type": "User",
"site_admin": false
}
],
"milestone": null,
"comments": 0,
"created_at": "2023-04-02T17:46:31Z",
"updated_at": "2023-06-10T08:00:10Z",
"closed_at": null,
"author_association": "OWNER",
"active_lock_reason": null,
"body": "This tests the functionality of the GH Integration. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc id sagittis ex. In at malesuada velit. Nulla convallis sem ultrices sapien finibus, a auctor nibh egestas. Cras mattis tristique ex, vitae pretium ante tempor vel. Vestibulum lacus tellus, rutrum ut neque eu, ornare facilisis diam. Curabitur ultrices mauris dolor, at lacinia felis mollis in. Fusce tincidunt magna a erat mollis volutpat. Etiam fringilla, ipsum ac vehicula pellentesque, purus augue viverra nunc, vel lacinia felis lectus ac risus. Morbi magna elit, tempus quis euismod quis, auctor ac diam. Nam quis tristique ligula. Proin ut est accumsan, ornare risus vel, fringilla ipsum.",
"reactions": {
"url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/6/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
},
"timeline_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/6/timeline",
"performed_via_github_app": null,
"state_reason": null
},
"milestone": {
"url": "https://api.github.com/repos/sbansal1999/testing-gh/milestones/1",
"html_url": "https://github.com/sbansal1999/testing-gh/milestone/1",
"labels_url": "https://api.github.com/repos/sbansal1999/testing-gh/milestones/1/labels",
"id": 9470891,
"node_id": "MI_kwDOJRp_V84AkIOr",
"number": 1,
"title": "some_random_milestone",
"description": null,
"creator": {
"login": "sbansal1999",
"id": 35286603,
"node_id": "MDQ6VXNlcjM1Mjg2NjAz",
"avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sbansal1999",
"html_url": "https://github.com/sbansal1999",
"followers_url": "https://api.github.com/users/sbansal1999/followers",
"following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
"gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
"organizations_url": "https://api.github.com/users/sbansal1999/orgs",
"repos_url": "https://api.github.com/users/sbansal1999/repos",
"events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
"received_events_url": "https://api.github.com/users/sbansal1999/received_events",
"type": "User",
"site_admin": false
},
"open_issues": 0,
"closed_issues": 1,
"state": "open",
"created_at": "2023-06-01T06:35:53Z",
"updated_at": "2023-06-10T08:00:10Z",
"due_on": null,
"closed_at": null
},
"repository": {
"id": 622493527,
"node_id": "R_kgDOJRp_Vw",
"name": "testing-gh",
"full_name": "sbansal1999/testing-gh",
"private": false,
"owner": {
"login": "sbansal1999",
"id": 35286603,
"node_id": "MDQ6VXNlcjM1Mjg2NjAz",
"avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sbansal1999",
"html_url": "https://github.com/sbansal1999",
"followers_url": "https://api.github.com/users/sbansal1999/followers",
"following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
"gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
"organizations_url": "https://api.github.com/users/sbansal1999/orgs",
"repos_url": "https://api.github.com/users/sbansal1999/repos",
"events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
"received_events_url": "https://api.github.com/users/sbansal1999/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/sbansal1999/testing-gh",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/sbansal1999/testing-gh",
"forks_url": "https://api.github.com/repos/sbansal1999/testing-gh/forks",
"keys_url": "https://api.github.com/repos/sbansal1999/testing-gh/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/sbansal1999/testing-gh/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/sbansal1999/testing-gh/teams",
"hooks_url": "https://api.github.com/repos/sbansal1999/testing-gh/hooks",
"issue_events_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/events{/number}",
"events_url": "https://api.github.com/repos/sbansal1999/testing-gh/events",
"assignees_url": "https://api.github.com/repos/sbansal1999/testing-gh/assignees{/user}",
"branches_url": "https://api.github.com/repos/sbansal1999/testing-gh/branches{/branch}",
"tags_url": "https://api.github.com/repos/sbansal1999/testing-gh/tags",
"blobs_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/sbansal1999/testing-gh/statuses/{sha}",
"languages_url": "https://api.github.com/repos/sbansal1999/testing-gh/languages",
"stargazers_url": "https://api.github.com/repos/sbansal1999/testing-gh/stargazers",
"contributors_url": "https://api.github.com/repos/sbansal1999/testing-gh/contributors",
"subscribers_url": "https://api.github.com/repos/sbansal1999/testing-gh/subscribers",
"subscription_url": "https://api.github.com/repos/sbansal1999/testing-gh/subscription",
"commits_url": "https://api.github.com/repos/sbansal1999/testing-gh/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/sbansal1999/testing-gh/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/sbansal1999/testing-gh/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/sbansal1999/testing-gh/contents/{+path}",
"compare_url": "https://api.github.com/repos/sbansal1999/testing-gh/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/sbansal1999/testing-gh/merges",
"archive_url": "https://api.github.com/repos/sbansal1999/testing-gh/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/sbansal1999/testing-gh/downloads",
"issues_url": "https://api.github.com/repos/sbansal1999/testing-gh/issues{/number}",
"pulls_url": "https://api.github.com/repos/sbansal1999/testing-gh/pulls{/number}",
"milestones_url": "https://api.github.com/repos/sbansal1999/testing-gh/milestones{/number}",
"notifications_url": "https://api.github.com/repos/sbansal1999/testing-gh/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/sbansal1999/testing-gh/labels{/name}",
"releases_url": "https://api.github.com/repos/sbansal1999/testing-gh/releases{/id}",
"deployments_url": "https://api.github.com/repos/sbansal1999/testing-gh/deployments",
"created_at": "2023-04-02T09:31:40Z",
"updated_at": "2023-04-02T09:31:40Z",
"pushed_at": "2023-05-29T16:34:46Z",
"git_url": "git://github.com/sbansal1999/testing-gh.git",
"ssh_url": "git@github.com:sbansal1999/testing-gh.git",
"clone_url": "https://github.com/sbansal1999/testing-gh.git",
"svn_url": "https://github.com/sbansal1999/testing-gh",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 7,
"license": null,
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 7,
"watchers": 0,
"default_branch": "fixing-typo"
},
"sender": {
"login": "sbansal1999",
"id": 35286603,
"node_id": "MDQ6VXNlcjM1Mjg2NjAz",
"avatar_url": "https://avatars.githubusercontent.com/u/35286603?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/sbansal1999",
"html_url": "https://github.com/sbansal1999",
"followers_url": "https://api.github.com/users/sbansal1999/followers",
"following_url": "https://api.github.com/users/sbansal1999/following{/other_user}",
"gists_url": "https://api.github.com/users/sbansal1999/gists{/gist_id}",
"starred_url": "https://api.github.com/users/sbansal1999/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/sbansal1999/subscriptions",
"organizations_url": "https://api.github.com/users/sbansal1999/orgs",
"repos_url": "https://api.github.com/users/sbansal1999/repos",
"events_url": "https://api.github.com/users/sbansal1999/events{/privacy}",
"received_events_url": "https://api.github.com/users/sbansal1999/received_events",
"type": "User",
"site_admin": false
}
}

View File

@@ -206,6 +206,12 @@ class GitHubWebhookTest(WebhookTestCase):
self.check_webhook("issues__milestoned", expected_topic, expected_message)
def test_issue_demilestoned(self) -> None:
expected_topic = "testing-gh / issue #6 This is a sample issue to test GH I..."
expected_message = "sbansal1999 demilestoned [issue #6](https://github.com/sbansal1999/testing-gh/issues/6):\n\n~~~ quote\nThis tests the functionality of the GH Integration. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc id sagittis ex. In at malesuada velit. Nulla convallis sem ultrices sapien finibus, a auctor nibh egestas. Cras mattis tristique ex, vitae pretium ante tempor vel. Vestibulum lacus tellus, rutrum ut neque eu, ornare facilisis diam. Curabitur ultrices mauris dolor, at lacinia felis mollis in. Fusce tincidunt magna a erat mollis volutpat. Etiam fringilla, ipsum ac vehicula pellentesque, purus augue viverra nunc, vel lacinia felis lectus ac risus. Morbi magna elit, tempus quis euismod quis, auctor ac diam. Nam quis tristique ligula. Proin ut est accumsan, ornare risus vel, fringilla ipsum.\n~~~"
self.check_webhook("issues__demilestoned", expected_topic, expected_message)
def test_membership_msg(self) -> None:
expected_message = (
"baxterthehacker added [kdaigle](https://github.com/kdaigle) to the Contractors team."