diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index ecd1f948d1..baa8a74800 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -101,7 +101,7 @@ public URL getProtectionUrl() { * the io exception */ public GHBranchProtection getProtection() throws IOException { - return root.createRequest().withUrlPath(protection_url).fetch(GHBranchProtection.class).wrap(this); + return root.createRequest().setRawUrlPath(protection_url).fetch(GHBranchProtection.class).wrap(this); } /** @@ -120,7 +120,7 @@ public String getSHA1() { * if disabling protection fails */ public void disableProtection() throws IOException { - root.createRequest().method("DELETE").withUrlPath(protection_url).send(); + root.createRequest().method("DELETE").setRawUrlPath(protection_url).send(); } /** diff --git a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java old mode 100644 new mode 100755 index 7f15ea61c9..142d27492d --- a/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java +++ b/src/test/java/org/kohsuke/github/GHBranchProtectionTest.java @@ -54,6 +54,14 @@ public void testEnableProtectionOnly() throws Exception { assertTrue(repo.getBranch(BRANCH).isProtected()); } + @Test + public void testDisableProtectionOnly() throws Exception { + GHBranchProtection protection = branch.enableProtection().enable(); + assertTrue(repo.getBranch(BRANCH).isProtected()); + branch.disableProtection(); + assertFalse(repo.getBranch(BRANCH).isProtected()); + } + @Test public void testEnableRequireReviewsOnly() throws Exception { GHBranchProtection protection = branch.enableProtection().requireReviews().enable(); @@ -73,4 +81,12 @@ public void testSignedCommits() throws Exception { protection.disableSignedCommits(); assertFalse(protection.getRequiredSignatures()); } + + @Test + public void testGetProtection() throws Exception { + GHBranchProtection protection = branch.enableProtection().enable(); + GHBranchProtection protectionTest = repo.getBranch(BRANCH).getProtection(); + assertTrue(protectionTest instanceof GHBranchProtection); + assertTrue(repo.getBranch(BRANCH).isProtected()); + } } diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly-2.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly-2.json new file mode 100644 index 0000000000..f1b57e821d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly-2.json @@ -0,0 +1,126 @@ +{ + "id": 258288342, + "node_id": "MDEwOlJlcG9zaXRvcnkyNTgyODgzNDI=", + "name": "temp-testDisableProtectionOnly", + "full_name": "github-api-test-org/temp-testDisableProtectionOnly", + "private": false, + "owner": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly", + "description": "A test repository for testing the github-api project: temp-testDisableProtectionOnly", + "fork": false, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/deployments", + "created_at": "2020-04-23T17:59:02Z", + "updated_at": "2020-04-23T17:59:06Z", + "pushed_at": "2020-04-23T17:59:04Z", + "git_url": "git://github.com/github-api-test-org/temp-testDisableProtectionOnly.git", + "ssh_url": "git@github.com:github-api-test-org/temp-testDisableProtectionOnly.git", + "clone_url": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly.git", + "svn_url": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly", + "homepage": "http://github-api.kohsuke.org/", + "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, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json new file mode 100644 index 0000000000..0bd8857239 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json @@ -0,0 +1,89 @@ +{ + "name": "master", + "commit": { + "sha": "dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "node_id": "MDY6Q29tbWl0MjU4Mjg4MzQyOmRkOGNlMjUwMzRlODU5NzNhOGNmYWNiMWIzNzk1NzFlYTNiNGE4YTY=", + "commit": { + "author": { + "name": "Liam Newman", + "email": "bitwiseman@gmail.com", + "date": "2020-04-23T17:59:03Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2020-04-23T17:59:03Z" + }, + "message": "Initial commit", + "tree": { + "sha": "e0f408fb90498b93fb29f15f65a716d635b935aa", + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/trees/e0f408fb90498b93fb29f15f65a716d635b935aa" + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBcBAABCAAQBQJeoddnCRBK7hj4Ov3rIwAAdHIIAIv1r34nroEHWPNwCvI3P/A7\ng3nDhupwv9OerOc+bvMeovLfsKIkpiHmz3qESI2ei5XL6ZNPffbhe1w7GG8ISF5g\ncJLQ84D+qk/rcOni3PJZj2n/3ChB+//lid6Op2O6TUuZ1omoxIeNzurIUJ7H0gux\nUB0siDrXMc5XXZw5kGQBWwVbc0HVB6lyxQ6s1Ct8w3KgcEGkxv97QsAVR7SvKir2\naI/uu0TB61KnsKh5igvGyT5i+a+fgMXsyV9i/qGSCvoueehSRa5XUHWD8hyDJOBG\nXwOzn696UNyl+0xZo/zHq2fyTeJY8siEyASpAh4KQkGbSHYNakLu+vxzwBB9U28=\n=3X5V\n-----END PGP SIGNATURE-----\n", + "payload": "tree e0f408fb90498b93fb29f15f65a716d635b935aa\nauthor Liam Newman 1587664743 -0700\ncommitter GitHub 1587664743 -0700\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "html_url": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly/commit/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6/comments", + "author": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master", + "html": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly/tree/master" + }, + "protected": false, + "protection": { + "enabled": false, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [] + } + }, + "protection_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json new file mode 100644 index 0000000000..880cd173ea --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json @@ -0,0 +1,89 @@ +{ + "name": "master", + "commit": { + "sha": "dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "node_id": "MDY6Q29tbWl0MjU4Mjg4MzQyOmRkOGNlMjUwMzRlODU5NzNhOGNmYWNiMWIzNzk1NzFlYTNiNGE4YTY=", + "commit": { + "author": { + "name": "Liam Newman", + "email": "bitwiseman@gmail.com", + "date": "2020-04-23T17:59:03Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2020-04-23T17:59:03Z" + }, + "message": "Initial commit", + "tree": { + "sha": "e0f408fb90498b93fb29f15f65a716d635b935aa", + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/trees/e0f408fb90498b93fb29f15f65a716d635b935aa" + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBcBAABCAAQBQJeoddnCRBK7hj4Ov3rIwAAdHIIAIv1r34nroEHWPNwCvI3P/A7\ng3nDhupwv9OerOc+bvMeovLfsKIkpiHmz3qESI2ei5XL6ZNPffbhe1w7GG8ISF5g\ncJLQ84D+qk/rcOni3PJZj2n/3ChB+//lid6Op2O6TUuZ1omoxIeNzurIUJ7H0gux\nUB0siDrXMc5XXZw5kGQBWwVbc0HVB6lyxQ6s1Ct8w3KgcEGkxv97QsAVR7SvKir2\naI/uu0TB61KnsKh5igvGyT5i+a+fgMXsyV9i/qGSCvoueehSRa5XUHWD8hyDJOBG\nXwOzn696UNyl+0xZo/zHq2fyTeJY8siEyASpAh4KQkGbSHYNakLu+vxzwBB9U28=\n=3X5V\n-----END PGP SIGNATURE-----\n", + "payload": "tree e0f408fb90498b93fb29f15f65a716d635b935aa\nauthor Liam Newman 1587664743 -0700\ncommitter GitHub 1587664743 -0700\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "html_url": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly/commit/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6/comments", + "author": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master", + "html": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly/tree/master" + }, + "protected": true, + "protection": { + "enabled": true, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [] + } + }, + "protection_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json new file mode 100644 index 0000000000..0bd8857239 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json @@ -0,0 +1,89 @@ +{ + "name": "master", + "commit": { + "sha": "dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "node_id": "MDY6Q29tbWl0MjU4Mjg4MzQyOmRkOGNlMjUwMzRlODU5NzNhOGNmYWNiMWIzNzk1NzFlYTNiNGE4YTY=", + "commit": { + "author": { + "name": "Liam Newman", + "email": "bitwiseman@gmail.com", + "date": "2020-04-23T17:59:03Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2020-04-23T17:59:03Z" + }, + "message": "Initial commit", + "tree": { + "sha": "e0f408fb90498b93fb29f15f65a716d635b935aa", + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/trees/e0f408fb90498b93fb29f15f65a716d635b935aa" + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/git/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBcBAABCAAQBQJeoddnCRBK7hj4Ov3rIwAAdHIIAIv1r34nroEHWPNwCvI3P/A7\ng3nDhupwv9OerOc+bvMeovLfsKIkpiHmz3qESI2ei5XL6ZNPffbhe1w7GG8ISF5g\ncJLQ84D+qk/rcOni3PJZj2n/3ChB+//lid6Op2O6TUuZ1omoxIeNzurIUJ7H0gux\nUB0siDrXMc5XXZw5kGQBWwVbc0HVB6lyxQ6s1Ct8w3KgcEGkxv97QsAVR7SvKir2\naI/uu0TB61KnsKh5igvGyT5i+a+fgMXsyV9i/qGSCvoueehSRa5XUHWD8hyDJOBG\nXwOzn696UNyl+0xZo/zHq2fyTeJY8siEyASpAh4KQkGbSHYNakLu+vxzwBB9U28=\n=3X5V\n-----END PGP SIGNATURE-----\n", + "payload": "tree e0f408fb90498b93fb29f15f65a716d635b935aa\nauthor Liam Newman 1587664743 -0700\ncommitter GitHub 1587664743 -0700\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "html_url": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly/commit/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/commits/dd8ce25034e85973a8cfacb1b379571ea3b4a8a6/comments", + "author": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master", + "html": "https://github.com/github-api-test-org/temp-testDisableProtectionOnly/tree/master" + }, + "protected": false, + "protection": { + "enabled": false, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [] + } + }, + "protection_url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json new file mode 100644 index 0000000000..910977f94d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json @@ -0,0 +1,16 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection", + "enforce_admins": { + "url": "https://api.github.com/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection/enforce_admins", + "enabled": false + }, + "required_linear_history": { + "enabled": false + }, + "allow_force_pushes": { + "enabled": false + }, + "allow_deletions": { + "enabled": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/user-1.json new file mode 100644 index 0000000000..c16e56c77f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 182, + "public_gists": 7, + "followers": 158, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-04-19T04:18:55Z", + "private_gists": 11, + "total_private_repos": 10, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly-2.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly-2.json new file mode 100644 index 0000000000..9abdf9bceb --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly-2.json @@ -0,0 +1,46 @@ +{ + "id": "7fa3e8d5-63ba-4f76-8548-13e9f41f86cf", + "name": "repos_github-api-test-org_temp-testdisableprotectiononly", + "request": { + "url": "/repos/github-api-test-org/temp-testDisableProtectionOnly", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testdisableprotectiononly-2.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:07 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4908", + "X-RateLimit-Reset": "1587666972", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"8e553a2c680e2cfce12ca4605a3832a9\"", + "Last-Modified": "Thu, 23 Apr 2020 17:59:06 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F68E:7228:10E85B:149297:5EA1D765" + } + }, + "uuid": "7fa3e8d5-63ba-4f76-8548-13e9f41f86cf", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json new file mode 100644 index 0000000000..f316409f8f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json @@ -0,0 +1,48 @@ +{ + "id": "1b81c7e8-f51d-42f3-bcfe-e0893ea2b29d", + "name": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master", + "request": { + "url": "/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-3.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:08 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4907", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"7c45580fa5c0f80cd87da42c36815e58\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F68E:7228:10E86E:1495EB:5EA1D76B" + } + }, + "uuid": "1b81c7e8-f51d-42f3-bcfe-e0893ea2b29d", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json new file mode 100644 index 0000000000..21a7a2f4c5 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json @@ -0,0 +1,48 @@ +{ + "id": "e5ca49c0-ac4e-4372-a3b7-128ed8ebff41", + "name": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master", + "request": { + "url": "/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-5.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:08 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4905", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"e8757475d9b3e089a5a3cd83499a2ceb\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F68E:7228:10E8B0:14962A:5EA1D76C" + } + }, + "uuid": "e5ca49c0-ac4e-4372-a3b7-128ed8ebff41", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master", + "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master-2", + "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master-3", + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json new file mode 100644 index 0000000000..774e972ee2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json @@ -0,0 +1,47 @@ +{ + "id": "e224c5e4-46a7-4ada-970d-946f4c31c8b4", + "name": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master", + "request": { + "url": "/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master-7.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:09 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4903", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"7c45580fa5c0f80cd87da42c36815e58\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F68E:7228:10E8F2:149684:5EA1D76D" + } + }, + "uuid": "e224c5e4-46a7-4ada-970d-946f4c31c8b4", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master", + "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testDisableProtectionOnly-branches-master-3", + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json new file mode 100644 index 0000000000..c42d9473e2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json @@ -0,0 +1,52 @@ +{ + "id": "9b035670-667b-480f-9a95-29acd553979f", + "name": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection", + "request": { + "url": "/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.luke-cage-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"required_pull_request_reviews\":null,\"required_status_checks\":null,\"restrictions\":null,\"enforce_admins\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-4.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:08 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4906", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"f36d8723d6bf669eda1f3f436c55694e\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.luke-cage-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F68E:7228:10E886:14960A:5EA1D76C" + } + }, + "uuid": "9b035670-667b-480f-9a95-29acd553979f", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-6.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-6.json new file mode 100644 index 0000000000..1515002c9c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection-6.json @@ -0,0 +1,38 @@ +{ + "id": "8ba747c1-29f2-4096-ad2e-5a148448adc2", + "name": "repos_github-api-test-org_temp-testdisableprotectiononly_branches_master_protection", + "request": { + "url": "/repos/github-api-test-org/temp-testDisableProtectionOnly/branches/master/protection", + "method": "DELETE", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 204, + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:09 GMT", + "Server": "GitHub.com", + "Status": "204 No Content", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4904", + "X-RateLimit-Reset": "1587666973", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "F68E:7228:10E8C7:14965A:5EA1D76C" + } + }, + "uuid": "8ba747c1-29f2-4096-ad2e-5a148448adc2", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/user-1.json new file mode 100644 index 0000000000..3cae29ce3b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testDisableProtectionOnly/mappings/user-1.json @@ -0,0 +1,46 @@ +{ + "id": "4d428d73-9af7-49af-aadd-cefd9eeefeff", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:59:01 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4913", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"ab45a166d7cdaf4738db7876a0b1d296\"", + "Last-Modified": "Sun, 19 Apr 2020 04:18:55 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F68E:7228:10E570:149284:5EA1D765" + } + }, + "uuid": "4d428d73-9af7-49af-aadd-cefd9eeefeff", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection-2.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection-2.json new file mode 100644 index 0000000000..e60929f83c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection-2.json @@ -0,0 +1,126 @@ +{ + "id": 258283935, + "node_id": "MDEwOlJlcG9zaXRvcnkyNTgyODM5MzU=", + "name": "temp-testGetProtection", + "full_name": "github-api-test-org/temp-testGetProtection", + "private": false, + "owner": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://github.com/github-api-test-org/temp-testGetProtection", + "description": "A test repository for testing the github-api project: temp-testGetProtection", + "fork": false, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/deployments", + "created_at": "2020-04-23T17:41:59Z", + "updated_at": "2020-04-23T17:42:03Z", + "pushed_at": "2020-04-23T17:42:01Z", + "git_url": "git://github.com/github-api-test-org/temp-testGetProtection.git", + "ssh_url": "git@github.com:github-api-test-org/temp-testGetProtection.git", + "clone_url": "https://github.com/github-api-test-org/temp-testGetProtection.git", + "svn_url": "https://github.com/github-api-test-org/temp-testGetProtection", + "homepage": "http://github-api.kohsuke.org/", + "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, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "organization": { + "login": "github-api-test-org", + "id": 7544739, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", + "avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/github-api-test-org", + "html_url": "https://github.com/github-api-test-org", + "followers_url": "https://api.github.com/users/github-api-test-org/followers", + "following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}", + "gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}", + "starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions", + "organizations_url": "https://api.github.com/users/github-api-test-org/orgs", + "repos_url": "https://api.github.com/users/github-api-test-org/repos", + "events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}", + "received_events_url": "https://api.github.com/users/github-api-test-org/received_events", + "type": "Organization", + "site_admin": false + }, + "network_count": 0, + "subscribers_count": 8 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-3.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-3.json new file mode 100644 index 0000000000..b72ebe835d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-3.json @@ -0,0 +1,89 @@ +{ + "name": "master", + "commit": { + "sha": "24fbd7cfa8192262e63efd9e64c4005e64429508", + "node_id": "MDY6Q29tbWl0MjU4MjgzOTM1OjI0ZmJkN2NmYTgxOTIyNjJlNjNlZmQ5ZTY0YzQwMDVlNjQ0Mjk1MDg=", + "commit": { + "author": { + "name": "Liam Newman", + "email": "bitwiseman@gmail.com", + "date": "2020-04-23T17:42:00Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2020-04-23T17:42:00Z" + }, + "message": "Initial commit", + "tree": { + "sha": "7e4b67f31859a5c6348d83419539ba9fa8864ed0", + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/trees/7e4b67f31859a5c6348d83419539ba9fa8864ed0" + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/commits/24fbd7cfa8192262e63efd9e64c4005e64429508", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBcBAABCAAQBQJeodNoCRBK7hj4Ov3rIwAAdHIIABVjG29Eq8rutPjoj27JFA0K\nfu9nvW5Rtu7nrONdwoOOpkV5gE//JCwtUGdQgkG1/gpNt6YvZ+gl+dk8uGFgF6Hc\nOI6yviZmlofd/95hATqB81w/b9r3nxNROw9WRpmDWZslHZvEfumyGMsB5qq2ig8N\npGgNkGRE2EIepv/m0rudorZMGrvUt3RT2CBqGc5lmPQoYXKlvHjo4/vx/tdQq6ev\n2orEjhyibWRNwulGbBdCLeqdOjYTBEjQ4dSCdanXUd6bY0JXojc2EufUOI80mFne\nIab5ZeyYbaznvmCl4j1OPl78H4G19Cee/r3EUxHuWZb+Re3xOSy5ldH9OWCTCJM=\n=LJqa\n-----END PGP SIGNATURE-----\n", + "payload": "tree 7e4b67f31859a5c6348d83419539ba9fa8864ed0\nauthor Liam Newman 1587663720 -0700\ncommitter GitHub 1587663720 -0700\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits/24fbd7cfa8192262e63efd9e64c4005e64429508", + "html_url": "https://github.com/github-api-test-org/temp-testGetProtection/commit/24fbd7cfa8192262e63efd9e64c4005e64429508", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits/24fbd7cfa8192262e63efd9e64c4005e64429508/comments", + "author": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master", + "html": "https://github.com/github-api-test-org/temp-testGetProtection/tree/master" + }, + "protected": false, + "protection": { + "enabled": false, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [] + } + }, + "protection_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-5.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-5.json new file mode 100644 index 0000000000..512e04d989 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-5.json @@ -0,0 +1,89 @@ +{ + "name": "master", + "commit": { + "sha": "24fbd7cfa8192262e63efd9e64c4005e64429508", + "node_id": "MDY6Q29tbWl0MjU4MjgzOTM1OjI0ZmJkN2NmYTgxOTIyNjJlNjNlZmQ5ZTY0YzQwMDVlNjQ0Mjk1MDg=", + "commit": { + "author": { + "name": "Liam Newman", + "email": "bitwiseman@gmail.com", + "date": "2020-04-23T17:42:00Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2020-04-23T17:42:00Z" + }, + "message": "Initial commit", + "tree": { + "sha": "7e4b67f31859a5c6348d83419539ba9fa8864ed0", + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/trees/7e4b67f31859a5c6348d83419539ba9fa8864ed0" + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/commits/24fbd7cfa8192262e63efd9e64c4005e64429508", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBcBAABCAAQBQJeodNoCRBK7hj4Ov3rIwAAdHIIABVjG29Eq8rutPjoj27JFA0K\nfu9nvW5Rtu7nrONdwoOOpkV5gE//JCwtUGdQgkG1/gpNt6YvZ+gl+dk8uGFgF6Hc\nOI6yviZmlofd/95hATqB81w/b9r3nxNROw9WRpmDWZslHZvEfumyGMsB5qq2ig8N\npGgNkGRE2EIepv/m0rudorZMGrvUt3RT2CBqGc5lmPQoYXKlvHjo4/vx/tdQq6ev\n2orEjhyibWRNwulGbBdCLeqdOjYTBEjQ4dSCdanXUd6bY0JXojc2EufUOI80mFne\nIab5ZeyYbaznvmCl4j1OPl78H4G19Cee/r3EUxHuWZb+Re3xOSy5ldH9OWCTCJM=\n=LJqa\n-----END PGP SIGNATURE-----\n", + "payload": "tree 7e4b67f31859a5c6348d83419539ba9fa8864ed0\nauthor Liam Newman 1587663720 -0700\ncommitter GitHub 1587663720 -0700\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits/24fbd7cfa8192262e63efd9e64c4005e64429508", + "html_url": "https://github.com/github-api-test-org/temp-testGetProtection/commit/24fbd7cfa8192262e63efd9e64c4005e64429508", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits/24fbd7cfa8192262e63efd9e64c4005e64429508/comments", + "author": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master", + "html": "https://github.com/github-api-test-org/temp-testGetProtection/tree/master" + }, + "protected": true, + "protection": { + "enabled": true, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [] + } + }, + "protection_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-7.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-7.json new file mode 100644 index 0000000000..512e04d989 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master-7.json @@ -0,0 +1,89 @@ +{ + "name": "master", + "commit": { + "sha": "24fbd7cfa8192262e63efd9e64c4005e64429508", + "node_id": "MDY6Q29tbWl0MjU4MjgzOTM1OjI0ZmJkN2NmYTgxOTIyNjJlNjNlZmQ5ZTY0YzQwMDVlNjQ0Mjk1MDg=", + "commit": { + "author": { + "name": "Liam Newman", + "email": "bitwiseman@gmail.com", + "date": "2020-04-23T17:42:00Z" + }, + "committer": { + "name": "GitHub", + "email": "noreply@github.com", + "date": "2020-04-23T17:42:00Z" + }, + "message": "Initial commit", + "tree": { + "sha": "7e4b67f31859a5c6348d83419539ba9fa8864ed0", + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/trees/7e4b67f31859a5c6348d83419539ba9fa8864ed0" + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/git/commits/24fbd7cfa8192262e63efd9e64c4005e64429508", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nwsBcBAABCAAQBQJeodNoCRBK7hj4Ov3rIwAAdHIIABVjG29Eq8rutPjoj27JFA0K\nfu9nvW5Rtu7nrONdwoOOpkV5gE//JCwtUGdQgkG1/gpNt6YvZ+gl+dk8uGFgF6Hc\nOI6yviZmlofd/95hATqB81w/b9r3nxNROw9WRpmDWZslHZvEfumyGMsB5qq2ig8N\npGgNkGRE2EIepv/m0rudorZMGrvUt3RT2CBqGc5lmPQoYXKlvHjo4/vx/tdQq6ev\n2orEjhyibWRNwulGbBdCLeqdOjYTBEjQ4dSCdanXUd6bY0JXojc2EufUOI80mFne\nIab5ZeyYbaznvmCl4j1OPl78H4G19Cee/r3EUxHuWZb+Re3xOSy5ldH9OWCTCJM=\n=LJqa\n-----END PGP SIGNATURE-----\n", + "payload": "tree 7e4b67f31859a5c6348d83419539ba9fa8864ed0\nauthor Liam Newman 1587663720 -0700\ncommitter GitHub 1587663720 -0700\n\nInitial commit" + } + }, + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits/24fbd7cfa8192262e63efd9e64c4005e64429508", + "html_url": "https://github.com/github-api-test-org/temp-testGetProtection/commit/24fbd7cfa8192262e63efd9e64c4005e64429508", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/commits/24fbd7cfa8192262e63efd9e64c4005e64429508/comments", + "author": { + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars3.githubusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/web-flow", + "html_url": "https://github.com/web-flow", + "followers_url": "https://api.github.com/users/web-flow/followers", + "following_url": "https://api.github.com/users/web-flow/following{/other_user}", + "gists_url": "https://api.github.com/users/web-flow/gists{/gist_id}", + "starred_url": "https://api.github.com/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/web-flow/subscriptions", + "organizations_url": "https://api.github.com/users/web-flow/orgs", + "repos_url": "https://api.github.com/users/web-flow/repos", + "events_url": "https://api.github.com/users/web-flow/events{/privacy}", + "received_events_url": "https://api.github.com/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [] + }, + "_links": { + "self": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master", + "html": "https://github.com/github-api-test-org/temp-testGetProtection/tree/master" + }, + "protected": true, + "protection": { + "enabled": true, + "required_status_checks": { + "enforcement_level": "off", + "contexts": [] + } + }, + "protection_url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json new file mode 100644 index 0000000000..a3b6658e5e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json @@ -0,0 +1,16 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection", + "enforce_admins": { + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection/enforce_admins", + "enabled": false + }, + "required_linear_history": { + "enabled": false + }, + "allow_force_pushes": { + "enabled": false + }, + "allow_deletions": { + "enabled": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json new file mode 100644 index 0000000000..a3b6658e5e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json @@ -0,0 +1,16 @@ +{ + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection", + "enforce_admins": { + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetProtection/branches/master/protection/enforce_admins", + "enabled": false + }, + "required_linear_history": { + "enabled": false + }, + "allow_force_pushes": { + "enabled": false + }, + "allow_deletions": { + "enabled": false + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/user-1.json new file mode 100644 index 0000000000..c16e56c77f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/__files/user-1.json @@ -0,0 +1,45 @@ +{ + "login": "bitwiseman", + "id": 1958953, + "node_id": "MDQ6VXNlcjE5NTg5NTM=", + "avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/bitwiseman", + "html_url": "https://github.com/bitwiseman", + "followers_url": "https://api.github.com/users/bitwiseman/followers", + "following_url": "https://api.github.com/users/bitwiseman/following{/other_user}", + "gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}", + "starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions", + "organizations_url": "https://api.github.com/users/bitwiseman/orgs", + "repos_url": "https://api.github.com/users/bitwiseman/repos", + "events_url": "https://api.github.com/users/bitwiseman/events{/privacy}", + "received_events_url": "https://api.github.com/users/bitwiseman/received_events", + "type": "User", + "site_admin": false, + "name": "Liam Newman", + "company": "Cloudbees, Inc.", + "blog": "", + "location": "Seattle, WA, USA", + "email": "bitwiseman@gmail.com", + "hireable": null, + "bio": "https://twitter.com/bitwiseman", + "public_repos": 182, + "public_gists": 7, + "followers": 158, + "following": 9, + "created_at": "2012-07-11T20:38:33Z", + "updated_at": "2020-04-19T04:18:55Z", + "private_gists": 11, + "total_private_repos": 10, + "owned_private_repos": 0, + "disk_usage": 33697, + "collaborators": 0, + "two_factor_authentication": true, + "plan": { + "name": "free", + "space": 976562499, + "collaborators": 0, + "private_repos": 10000 + } +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection-2.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection-2.json new file mode 100644 index 0000000000..4674428187 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection-2.json @@ -0,0 +1,46 @@ +{ + "id": "2337b0a7-eeca-48be-a266-0a068a79e12e", + "name": "repos_github-api-test-org_temp-testgetprotection", + "request": { + "url": "/repos/github-api-test-org/temp-testGetProtection", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testgetprotection-2.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:42:04 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4933", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"d13b13503d75ee6f873b07336e3980d6\"", + "Last-Modified": "Thu, 23 Apr 2020 17:42:03 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C1B6:848F3:5EA1D366" + } + }, + "uuid": "2337b0a7-eeca-48be-a266-0a068a79e12e", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-3.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-3.json new file mode 100644 index 0000000000..89eec01144 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-3.json @@ -0,0 +1,48 @@ +{ + "id": "1b37059d-fd2e-4bf9-91aa-320203aad872", + "name": "repos_github-api-test-org_temp-testgetprotection_branches_master", + "request": { + "url": "/repos/github-api-test-org/temp-testGetProtection/branches/master", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testgetprotection_branches_master-3.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:42:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4932", + "X-RateLimit-Reset": "1587666972", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"7fdb679ba6b890c4bb0b4d403e27fbef\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C1BD:84A13:5EA1D36C" + } + }, + "uuid": "1b37059d-fd2e-4bf9-91aa-320203aad872", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-5.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-5.json new file mode 100644 index 0000000000..b1c2886381 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-5.json @@ -0,0 +1,48 @@ +{ + "id": "a5a370a5-6d8e-4e98-bdd9-324083d7b521", + "name": "repos_github-api-test-org_temp-testgetprotection_branches_master", + "request": { + "url": "/repos/github-api-test-org/temp-testGetProtection/branches/master", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testgetprotection_branches_master-5.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:42:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4930", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"dc3ff5ae90ceaed2515f7c337b51a17e\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C1D9:84A33:5EA1D36D" + } + }, + "uuid": "a5a370a5-6d8e-4e98-bdd9-324083d7b521", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master", + "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master-2", + "newScenarioState": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master-3", + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-7.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-7.json new file mode 100644 index 0000000000..4d4e3f1e1b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master-7.json @@ -0,0 +1,47 @@ +{ + "id": "12d8726c-e383-45d3-8da7-cfec0d043b64", + "name": "repos_github-api-test-org_temp-testgetprotection_branches_master", + "request": { + "url": "/repos/github-api-test-org/temp-testGetProtection/branches/master", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testgetprotection_branches_master-7.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:42:06 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4928", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"dc3ff5ae90ceaed2515f7c337b51a17e\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C1F9:84A53:5EA1D36D" + } + }, + "uuid": "12d8726c-e383-45d3-8da7-cfec0d043b64", + "persistent": true, + "scenarioName": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master", + "requiredScenarioState": "scenario-1-repos-github-api-test-org-temp-testGetProtection-branches-master-3", + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json new file mode 100644 index 0000000000..d450fbb39b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json @@ -0,0 +1,52 @@ +{ + "id": "d52c7355-8eac-4c62-b83d-54ebacfc0c70", + "name": "repos_github-api-test-org_temp-testgetprotection_branches_master_protection", + "request": { + "url": "/repos/github-api-test-org/temp-testGetProtection/branches/master/protection", + "method": "PUT", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.luke-cage-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"required_pull_request_reviews\":null,\"required_status_checks\":null,\"restrictions\":null,\"enforce_admins\":false}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testgetprotection_branches_master_protection-4.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:42:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4931", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"028cd5293b7178833f675036daf5ecf7\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.luke-cage-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C1C8:84A1F:5EA1D36D" + } + }, + "uuid": "d52c7355-8eac-4c62-b83d-54ebacfc0c70", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json new file mode 100644 index 0000000000..4c9265464e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json @@ -0,0 +1,45 @@ +{ + "id": "d15b0d15-1264-481d-9ec5-0e156de6f80a", + "name": "repos_github-api-test-org_temp-testgetprotection_branches_master_protection", + "request": { + "url": "/repos/github-api-test-org/temp-testGetProtection/branches/master/protection", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_github-api-test-org_temp-testgetprotection_branches_master_protection-6.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:42:05 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4929", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"4ae26e8f99ae0fd6e393517e28500f84\"", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C1E5:84A41:5EA1D36D" + } + }, + "uuid": "d15b0d15-1264-481d-9ec5-0e156de6f80a", + "persistent": true, + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/user-1.json new file mode 100644 index 0000000000..c234d2ead8 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHBranchProtectionTest/wiremock/testGetProtection/mappings/user-1.json @@ -0,0 +1,46 @@ +{ + "id": "346a521f-fc2e-488b-bcd0-a2612c647c91", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "user-1.json", + "headers": { + "Date": "Thu, 23 Apr 2020 17:41:58 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4938", + "X-RateLimit-Reset": "1587666973", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"ab45a166d7cdaf4738db7876a0b1d296\"", + "Last-Modified": "Sun, 19 Apr 2020 04:18:55 GMT", + "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "F2F9:7AE6:6C0D2:848EA:5EA1D366" + } + }, + "uuid": "346a521f-fc2e-488b-bcd0-a2612c647c91", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file