diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index ad15b6b32b..9508978eb1 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -424,4 +424,20 @@ public void listTags() throws Exception { assertThat(refs, notNullValue()); assertThat(refs.size(), greaterThan(90)); } + + @Test + public void checkWatchersCount() throws Exception { + snapshotNotAllowed(); + GHRepository repo = getTempRepository(); + int watchersCount = repo.getWatchers(); + assertEquals(10, watchersCount); + } + + @Test + public void checkStargazersCount() throws Exception { + snapshotNotAllowed(); + GHRepository repo = getTempRepository(); + int stargazersCount = repo.getStargazersCount(); + assertEquals(10, stargazersCount); + } } diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/__files/repos_github-api-test-org_temp-checkstargazerscount-bd22f750-1a7c-4274-b5d6-9e2164a1eb2a.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/__files/repos_github-api-test-org_temp-checkstargazerscount-bd22f750-1a7c-4274-b5d6-9e2164a1eb2a.json new file mode 100644 index 0000000000..c02f3e59e4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/__files/repos_github-api-test-org_temp-checkstargazerscount-bd22f750-1a7c-4274-b5d6-9e2164a1eb2a.json @@ -0,0 +1,126 @@ +{ + "id": 235867827, + "node_id": "MDEwOlJlcG9zaXRvcnkyMzU4Njc4Mjc=", + "name": "temp-checkStargazersCount", + "full_name": "github-api-test-org/temp-checkStargazersCount", + "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-checkStargazersCount", + "description": "A test repository for testing the github-api project: temp-checkStargazersCount", + "fork": false, + "url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-checkStargazersCount/deployments", + "created_at": "2020-01-23T19:16:16Z", + "updated_at": "2020-01-23T19:16:20Z", + "pushed_at": "2020-01-23T19:16:18Z", + "git_url": "git://github.com/github-api-test-org/temp-checkStargazersCount.git", + "ssh_url": "git@github.com:github-api-test-org/temp-checkStargazersCount.git", + "clone_url": "https://github.com/github-api-test-org/temp-checkStargazersCount.git", + "svn_url": "https://github.com/github-api-test-org/temp-checkStargazersCount", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 10, + "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": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/__files/user-ebb96197-f82b-4a05-87e8-932107fd594e.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/__files/user-ebb96197-f82b-4a05-87e8-932107fd594e.json new file mode 100644 index 0000000000..c0cf6a3a30 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/__files/user-ebb96197-f82b-4a05-87e8-932107fd594e.json @@ -0,0 +1,45 @@ +{ + "login": "alexanderrtaylor", + "id": 852179, + "node_id": "MDQ6VXNlcjg1MjE3OQ==", + "avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/alexanderrtaylor", + "html_url": "https://github.com/alexanderrtaylor", + "followers_url": "https://api.github.com/users/alexanderrtaylor/followers", + "following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}", + "gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions", + "organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs", + "repos_url": "https://api.github.com/users/alexanderrtaylor/repos", + "events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}", + "received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events", + "type": "User", + "site_admin": false, + "name": "Alex Taylor", + "company": "Cloudbees", + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": "This is the Way", + "public_repos": 40, + "public_gists": 1, + "followers": 5, + "following": 0, + "created_at": "2011-06-15T16:35:58Z", + "updated_at": "2020-01-10T13:31:02Z", + "private_gists": 1, + "total_private_repos": 15, + "owned_private_repos": 0, + "disk_usage": 277, + "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/GHRepositoryTest/wiremock/checkStargazersCount/mappings/repos_github-api-test-org_temp-checkstargazerscount-2-bd22f7.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/mappings/repos_github-api-test-org_temp-checkstargazerscount-2-bd22f7.json new file mode 100644 index 0000000000..5736687456 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/mappings/repos_github-api-test-org_temp-checkstargazerscount-2-bd22f7.json @@ -0,0 +1,45 @@ +{ + "id": "bd22f750-1a7c-4274-b5d6-9e2164a1eb2a", + "name": "repos_github-api-test-org_temp-checkstargazerscount", + "request": { + "url": "/repos/github-api-test-org/temp-checkStargazersCount", + "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-checkstargazerscount-bd22f750-1a7c-4274-b5d6-9e2164a1eb2a.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 23 Jan 2020 19:16:21 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4920", + "X-RateLimit-Reset": "1579808711", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"f30e5b1563a06b458b3e7337252b42c1\"", + "Last-Modified": "Thu, 23 Jan 2020 19:16:20 GMT", + "X-OAuth-Scopes": "admin:gpg_key, 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", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "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": "FDD6:6F1D:4BF06C:BD9B80:5E29F0FF" + } + }, + "uuid": "bd22f750-1a7c-4274-b5d6-9e2164a1eb2a", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/mappings/user-1-ebb961.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/mappings/user-1-ebb961.json new file mode 100644 index 0000000000..4c8fadf7ce --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkStargazersCount/mappings/user-1-ebb961.json @@ -0,0 +1,45 @@ +{ + "id": "ebb96197-f82b-4a05-87e8-932107fd594e", + "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-ebb96197-f82b-4a05-87e8-932107fd594e.json", + "headers": { + "Server": "GitHub.com", + "Date": "Thu, 23 Jan 2020 19:16:15 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4925", + "X-RateLimit-Reset": "1579808711", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP", + "ETag": "W/\"12d1d56c145aab04375c00af287e9ef0\"", + "Last-Modified": "Fri, 10 Jan 2020 13:31:02 GMT", + "X-OAuth-Scopes": "admin:gpg_key, 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", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "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": "FDD6:6F1D:4BEF7C:BD9B79:5E29F0FF" + } + }, + "uuid": "ebb96197-f82b-4a05-87e8-932107fd594e", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/__files/repos_github-api-test-org_temp-checkwatcherscount-480b7f68-9bb9-4443-b01f-d617b71fd015.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/__files/repos_github-api-test-org_temp-checkwatcherscount-480b7f68-9bb9-4443-b01f-d617b71fd015.json new file mode 100644 index 0000000000..3bc595fdf0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/__files/repos_github-api-test-org_temp-checkwatcherscount-480b7f68-9bb9-4443-b01f-d617b71fd015.json @@ -0,0 +1,126 @@ +{ + "id": 235867740, + "node_id": "MDEwOlJlcG9zaXRvcnkyMzU4Njc3NDA=", + "name": "temp-checkWatchersCount", + "full_name": "github-api-test-org/temp-checkWatchersCount", + "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-checkWatchersCount", + "description": "A test repository for testing the github-api project: temp-checkWatchersCount", + "fork": false, + "url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-checkWatchersCount/deployments", + "created_at": "2020-01-23T19:15:46Z", + "updated_at": "2020-01-23T19:15:50Z", + "pushed_at": "2020-01-23T19:15:48Z", + "git_url": "git://github.com/github-api-test-org/temp-checkWatchersCount.git", + "ssh_url": "git@github.com:github-api-test-org/temp-checkWatchersCount.git", + "clone_url": "https://github.com/github-api-test-org/temp-checkWatchersCount.git", + "svn_url": "https://github.com/github-api-test-org/temp-checkWatchersCount", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 10, + "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": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/__files/user-2d950c1e-78e1-4883-af14-378fee1e9454.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/__files/user-2d950c1e-78e1-4883-af14-378fee1e9454.json new file mode 100644 index 0000000000..c0cf6a3a30 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/__files/user-2d950c1e-78e1-4883-af14-378fee1e9454.json @@ -0,0 +1,45 @@ +{ + "login": "alexanderrtaylor", + "id": 852179, + "node_id": "MDQ6VXNlcjg1MjE3OQ==", + "avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/alexanderrtaylor", + "html_url": "https://github.com/alexanderrtaylor", + "followers_url": "https://api.github.com/users/alexanderrtaylor/followers", + "following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}", + "gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}", + "starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions", + "organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs", + "repos_url": "https://api.github.com/users/alexanderrtaylor/repos", + "events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}", + "received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events", + "type": "User", + "site_admin": false, + "name": "Alex Taylor", + "company": "Cloudbees", + "blog": "", + "location": null, + "email": null, + "hireable": null, + "bio": "This is the Way", + "public_repos": 40, + "public_gists": 1, + "followers": 5, + "following": 0, + "created_at": "2011-06-15T16:35:58Z", + "updated_at": "2020-01-10T13:31:02Z", + "private_gists": 1, + "total_private_repos": 15, + "owned_private_repos": 0, + "disk_usage": 277, + "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/GHRepositoryTest/wiremock/checkWatchersCount/mappings/orgs_github-api-test-org-1-05a87d.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/mappings/orgs_github-api-test-org-1-05a87d.json new file mode 100644 index 0000000000..a902c601cf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/mappings/orgs_github-api-test-org-1-05a87d.json @@ -0,0 +1,43 @@ +{ + "id": "05a87d46-e21e-4b39-90fa-9ecf2906e550", + "name": "orgs_github-api-test-org", + "request": { + "url": "/orgs/github-api-test-org", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "orgs_github-api-test-org-05a87d46-e21e-4b39-90fa-9ecf2906e550.json", + "headers": { + "Server": "GitHub.com", + "Date": "Tue, 21 Jan 2020 18:17:31 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "60", + "X-RateLimit-Remaining": "25", + "X-RateLimit-Reset": "1579634247", + "Cache-Control": "public, max-age=60, s-maxage=60", + "Vary": "Accept", + "ETag": "W/\"344d9b542c3151b1973817461b0b7c48\"", + "Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "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": "FB78:0DBB:5534D2:AEDB99:5E27403B" + } + }, + "uuid": "05a87d46-e21e-4b39-90fa-9ecf2906e550", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/mappings/repos_github-api-test-org_temp-checkwatcherscount-2-480b7f.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/mappings/repos_github-api-test-org_temp-checkwatcherscount-2-480b7f.json new file mode 100644 index 0000000000..e0b0e2d94f --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/checkWatchersCount/mappings/repos_github-api-test-org_temp-checkwatcherscount-2-480b7f.json @@ -0,0 +1,49 @@ +{ + "id": "480b7f68-9bb9-4443-b01f-d617b71fd015", + "name": "repos_github-api-test-org_temp-checkwatcherscount", + "request": { + "url": "/repos/github-api-test-org/temp-checkWatchersCount", + "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-checkwatcherscount-480b7f68-9bb9-4443-b01f-d617b71fd015.json", + "headers": { + "Date": "Thu, 23 Jan 2020 19:15:51 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": "1579808711", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding", + "Accept-Encoding" + ], + "ETag": "W/\"0f221fe32212e39d2028da930db55d9f\"", + "Last-Modified": "Thu, 23 Jan 2020 19:15:50 GMT", + "X-OAuth-Scopes": "admin:gpg_key, 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", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type", + "Access-Control-Allow-Origin": "*", + "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": "FDCA:20D3:4C9169:BDFFB4:5E29F0E1" + } + }, + "uuid": "480b7f68-9bb9-4443-b01f-d617b71fd015", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file