integrations: Add force push fixtures for GitHub Integration.

One fixture is just removing commits; the other removes some commits
but adds others.
This commit is contained in:
sbansal1999
2023-05-04 20:42:59 +05:30
committed by Tim Abbott
parent 715fa3aff6
commit dba6f84b97
3 changed files with 368 additions and 0 deletions

View File

@@ -0,0 +1,192 @@
{
"ref": "refs/heads/temp",
"before": "b6de8891fc10adb01e608ea01db326e99278fc70",
"after": "971d76ca309446a9c20381f6271cea8a59b4e40a",
"repository": {
"id": 606370184,
"node_id": "R_kgDOJCR5iA",
"name": "zulip",
"full_name": "sbansal1999/zulip",
"private": false,
"owner": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com",
"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/zulip",
"description": "Zulip server and web application. Open-source team chat that helps teams stay productive and focused.",
"fork": true,
"url": "https://github.com/sbansal1999/zulip",
"forks_url": "https://api.github.com/repos/sbansal1999/zulip/forks",
"keys_url": "https://api.github.com/repos/sbansal1999/zulip/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/sbansal1999/zulip/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/sbansal1999/zulip/teams",
"hooks_url": "https://api.github.com/repos/sbansal1999/zulip/hooks",
"issue_events_url": "https://api.github.com/repos/sbansal1999/zulip/issues/events{/number}",
"events_url": "https://api.github.com/repos/sbansal1999/zulip/events",
"assignees_url": "https://api.github.com/repos/sbansal1999/zulip/assignees{/user}",
"branches_url": "https://api.github.com/repos/sbansal1999/zulip/branches{/branch}",
"tags_url": "https://api.github.com/repos/sbansal1999/zulip/tags",
"blobs_url": "https://api.github.com/repos/sbansal1999/zulip/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/sbansal1999/zulip/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/sbansal1999/zulip/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/sbansal1999/zulip/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/sbansal1999/zulip/statuses/{sha}",
"languages_url": "https://api.github.com/repos/sbansal1999/zulip/languages",
"stargazers_url": "https://api.github.com/repos/sbansal1999/zulip/stargazers",
"contributors_url": "https://api.github.com/repos/sbansal1999/zulip/contributors",
"subscribers_url": "https://api.github.com/repos/sbansal1999/zulip/subscribers",
"subscription_url": "https://api.github.com/repos/sbansal1999/zulip/subscription",
"commits_url": "https://api.github.com/repos/sbansal1999/zulip/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/sbansal1999/zulip/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/sbansal1999/zulip/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/sbansal1999/zulip/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/sbansal1999/zulip/contents/{+path}",
"compare_url": "https://api.github.com/repos/sbansal1999/zulip/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/sbansal1999/zulip/merges",
"archive_url": "https://api.github.com/repos/sbansal1999/zulip/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/sbansal1999/zulip/downloads",
"issues_url": "https://api.github.com/repos/sbansal1999/zulip/issues{/number}",
"pulls_url": "https://api.github.com/repos/sbansal1999/zulip/pulls{/number}",
"milestones_url": "https://api.github.com/repos/sbansal1999/zulip/milestones{/number}",
"notifications_url": "https://api.github.com/repos/sbansal1999/zulip/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/sbansal1999/zulip/labels{/name}",
"releases_url": "https://api.github.com/repos/sbansal1999/zulip/releases{/id}",
"deployments_url": "https://api.github.com/repos/sbansal1999/zulip/deployments",
"created_at": 1677317320,
"updated_at": "2023-02-26T07:37:10Z",
"pushed_at": 1683220524,
"git_url": "git://github.com/sbansal1999/zulip.git",
"ssh_url": "git@github.com:sbansal1999/zulip.git",
"clone_url": "https://github.com/sbansal1999/zulip.git",
"svn_url": "https://github.com/sbansal1999/zulip",
"homepage": "https://zulip.com",
"size": 394612,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Python",
"has_issues": false,
"has_projects": true,
"has_downloads": true,
"has_wiki": false,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 6,
"license": {
"key": "apache-2.0",
"name": "Apache License 2.0",
"spdx_id": "Apache-2.0",
"url": "https://api.github.com/licenses/apache-2.0",
"node_id": "MDc6TGljZW5zZTI="
},
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 6,
"watchers": 0,
"default_branch": "main",
"stargazers": 0,
"master_branch": "main"
},
"pusher": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com"
},
"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
},
"created": false,
"deleted": false,
"forced": true,
"base_ref": null,
"compare": "https://github.com/sbansal1999/zulip/compare/b6de8891fc10...971d76ca3094",
"commits": [
{
"id": "971d76ca309446a9c20381f6271cea8a59b4e40a",
"tree_id": "1e1050602fedd197200906a7042d789bca4fe820",
"distinct": true,
"message": "log: Add important.txt which is useful for logging errors.",
"timestamp": "2023-05-04T22:44:40+05:30",
"url": "https://github.com/sbansal1999/zulip/commit/971d76ca309446a9c20381f6271cea8a59b4e40a",
"author": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com",
"username": "sbansal1999"
},
"committer": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com",
"username": "sbansal1999"
},
"added": [
"important.txt"
],
"removed": [],
"modified": []
}
],
"head_commit": {
"id": "971d76ca309446a9c20381f6271cea8a59b4e40a",
"tree_id": "1e1050602fedd197200906a7042d789bca4fe820",
"distinct": true,
"message": "log: Add important.txt which is useful for logging errors.",
"timestamp": "2023-05-04T22:44:40+05:30",
"url": "https://github.com/sbansal1999/zulip/commit/971d76ca309446a9c20381f6271cea8a59b4e40a",
"author": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com",
"username": "sbansal1999"
},
"committer": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com",
"username": "sbansal1999"
},
"added": [
"important.txt"
],
"removed": [],
"modified": []
}
}

View File

@@ -0,0 +1,168 @@
{
"ref": "refs/heads/temp",
"before": "2084a91af9ca7c71b4dd020fb973292d92884324",
"after": "9a8749ea8fe78a9cde773c60acf54f81f82c5d7e",
"repository": {
"id": 606370184,
"node_id": "R_kgDOJCR5iA",
"name": "zulip",
"full_name": "sbansal1999/zulip",
"private": false,
"owner": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com",
"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/zulip",
"description": "Zulip server and web application. Open-source team chat that helps teams stay productive and focused.",
"fork": true,
"url": "https://github.com/sbansal1999/zulip",
"forks_url": "https://api.github.com/repos/sbansal1999/zulip/forks",
"keys_url": "https://api.github.com/repos/sbansal1999/zulip/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/sbansal1999/zulip/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/sbansal1999/zulip/teams",
"hooks_url": "https://api.github.com/repos/sbansal1999/zulip/hooks",
"issue_events_url": "https://api.github.com/repos/sbansal1999/zulip/issues/events{/number}",
"events_url": "https://api.github.com/repos/sbansal1999/zulip/events",
"assignees_url": "https://api.github.com/repos/sbansal1999/zulip/assignees{/user}",
"branches_url": "https://api.github.com/repos/sbansal1999/zulip/branches{/branch}",
"tags_url": "https://api.github.com/repos/sbansal1999/zulip/tags",
"blobs_url": "https://api.github.com/repos/sbansal1999/zulip/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/sbansal1999/zulip/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/sbansal1999/zulip/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/sbansal1999/zulip/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/sbansal1999/zulip/statuses/{sha}",
"languages_url": "https://api.github.com/repos/sbansal1999/zulip/languages",
"stargazers_url": "https://api.github.com/repos/sbansal1999/zulip/stargazers",
"contributors_url": "https://api.github.com/repos/sbansal1999/zulip/contributors",
"subscribers_url": "https://api.github.com/repos/sbansal1999/zulip/subscribers",
"subscription_url": "https://api.github.com/repos/sbansal1999/zulip/subscription",
"commits_url": "https://api.github.com/repos/sbansal1999/zulip/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/sbansal1999/zulip/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/sbansal1999/zulip/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/sbansal1999/zulip/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/sbansal1999/zulip/contents/{+path}",
"compare_url": "https://api.github.com/repos/sbansal1999/zulip/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/sbansal1999/zulip/merges",
"archive_url": "https://api.github.com/repos/sbansal1999/zulip/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/sbansal1999/zulip/downloads",
"issues_url": "https://api.github.com/repos/sbansal1999/zulip/issues{/number}",
"pulls_url": "https://api.github.com/repos/sbansal1999/zulip/pulls{/number}",
"milestones_url": "https://api.github.com/repos/sbansal1999/zulip/milestones{/number}",
"notifications_url": "https://api.github.com/repos/sbansal1999/zulip/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/sbansal1999/zulip/labels{/name}",
"releases_url": "https://api.github.com/repos/sbansal1999/zulip/releases{/id}",
"deployments_url": "https://api.github.com/repos/sbansal1999/zulip/deployments",
"created_at": 1677317320,
"updated_at": "2023-02-26T07:37:10Z",
"pushed_at": 1683201505,
"git_url": "git://github.com/sbansal1999/zulip.git",
"ssh_url": "git@github.com:sbansal1999/zulip.git",
"clone_url": "https://github.com/sbansal1999/zulip.git",
"svn_url": "https://github.com/sbansal1999/zulip",
"homepage": "https://zulip.com",
"size": 394610,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Python",
"has_issues": false,
"has_projects": true,
"has_downloads": true,
"has_wiki": false,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 6,
"license": {
"key": "apache-2.0",
"name": "Apache License 2.0",
"spdx_id": "Apache-2.0",
"url": "https://api.github.com/licenses/apache-2.0",
"node_id": "MDc6TGljZW5zZTI="
},
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "public",
"forks": 0,
"open_issues": 6,
"watchers": 0,
"default_branch": "main",
"stargazers": 0,
"master_branch": "main"
},
"pusher": {
"name": "sbansal1999",
"email": "sbansal1999@gmail.com"
},
"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
},
"created": false,
"deleted": false,
"forced": true,
"base_ref": null,
"compare": "https://github.com/sbansal1999/zulip/compare/2084a91af9ca...9a8749ea8fe7",
"commits": [],
"head_commit": {
"id": "9a8749ea8fe78a9cde773c60acf54f81f82c5d7e",
"tree_id": "44c09aa81080a562a6eb76d49ea060be03027582",
"distinct": true,
"message": "message_fetch: Fix stream narrows when everything recent is muted.",
"timestamp": "2023-05-03T18:40:59-07:00",
"url": "https://github.com/sbansal1999/zulip/commit/9a8749ea8fe78a9cde773c60acf54f81f82c5d7e",
"author": {
"name": "Tim Abbott",
"email": "tabbott@zulip.com",
"username": "timabbott"
},
"committer": {
"name": "Tim Abbott",
"email": "tabbott@zulip.com",
"username": "timabbott"
},
"added": [],
"removed": [],
"modified": [
"web/src/message_fetch.js"
]
}
}

View File

@@ -37,6 +37,14 @@ class GitHubWebhookTest(WebhookTestCase):
expected_message = "eeshangarg [deleted](https://github.com/eeshangarg/public-repo/compare/2e8cf535fb38...000000000000) the branch feature." expected_message = "eeshangarg [deleted](https://github.com/eeshangarg/public-repo/compare/2e8cf535fb38...000000000000) the branch feature."
self.check_webhook("push__delete_branch", "public-repo / feature", expected_message) self.check_webhook("push__delete_branch", "public-repo / feature", expected_message)
def test_push_force_1_commit(self) -> None:
expected_message = "sbansal1999 [pushed](https://github.com/sbansal1999/zulip/compare/b6de8891fc10...971d76ca3094) 1 commit to branch temp.\n\n* log: Add important.txt which is useful for logging errors. ([971d76ca309](https://github.com/sbansal1999/zulip/commit/971d76ca309446a9c20381f6271cea8a59b4e40a))"
self.check_webhook("push__force_1_commit", "zulip / temp", expected_message)
def test_push__force_remove_commits(self) -> None:
expected_message = "sbansal1999 [pushed](https://github.com/sbansal1999/zulip/compare/2084a91af9ca...9a8749ea8fe7) the branch temp."
self.check_webhook("push__force_remove_commits", "zulip / temp", expected_message)
def test_push_local_branch_without_commits(self) -> None: def test_push_local_branch_without_commits(self) -> None:
expected_message = "eeshangarg [pushed](https://github.com/eeshangarg/public-repo/compare/feature) the branch feature." expected_message = "eeshangarg [pushed](https://github.com/eeshangarg/public-repo/compare/feature) the branch feature."
self.check_webhook( self.check_webhook(