diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 9b4686cc04..21c9ea1e9d 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -230,6 +230,17 @@ public String getHttpTransportUrl() { return clone_url; } + /** + * Git http transport url string. + * + * @return the string + * @deprecated Typo of {@link #getHttpTransportUrl()} + */ + @Deprecated + public String gitHttpTransportUrl() { + return clone_url; + } + /** * Gets the Subversion URL to access this repository: https://github.com/rails/rails * diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index 5bbbf9dd84..ba9e29094b 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -26,6 +26,31 @@ private GHRepository getRepository(GitHub gitHub) throws IOException { return gitHub.getOrganization("github-api-test-org").getRepository("github-api"); } + @Test + public void testGetters() throws IOException { + GHRepository r = getTempRepository(); + + assertThat(r.hasAdminAccess(), is(true)); + assertThat(r.hasDownloads(), is(true)); + assertThat(r.hasIssues(), is(true)); + assertThat(r.hasPages(), is(false)); + assertThat(r.hasProjects(), is(true)); + assertThat(r.hasPullAccess(), is(true)); + assertThat(r.hasPushAccess(), is(true)); + assertThat(r.hasWiki(), is(true)); + + assertThat(r.isAllowMergeCommit(), is(true)); + assertThat(r.isAllowRebaseMerge(), is(true)); + assertThat(r.isAllowSquashMerge(), is(true)); + + String httpTransport = "https://github.com/github-api-test-org/temp-testGetters.git"; + assertThat(r.getHttpTransportUrl(), equalTo(httpTransport)); + assertThat(r.gitHttpTransportUrl(), equalTo(httpTransport)); + + assertThat(r.getName(), equalTo("temp-testGetters")); + assertThat(r.getFullName(), equalTo("github-api-test-org/temp-testGetters")); + } + @Test public void archive() throws Exception { snapshotNotAllowed(); @@ -274,14 +299,6 @@ public void markDown() throws Exception { assertTrue(actual.contains("to fix issue")); } - @Test - public void getMergeOptions() throws IOException { - GHRepository r = getTempRepository(); - assertNotNull(r.isAllowMergeCommit()); - assertNotNull(r.isAllowRebaseMerge()); - assertNotNull(r.isAllowSquashMerge()); - } - @Test public void setMergeOptions() throws IOException { // String repoName = "github-api-test-org/test-mergeoptions"; diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/__files/repos_github-api-test-org_temp-getmergeoptions-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_github-api-test-org_temp-testgetters-2.json similarity index 70% rename from src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/__files/repos_github-api-test-org_temp-getmergeoptions-2.json rename to src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_github-api-test-org_temp-testgetters-2.json index 3681e7f787..879b6cff60 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/__files/repos_github-api-test-org_temp-getmergeoptions-2.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/repos_github-api-test-org_temp-testgetters-2.json @@ -1,8 +1,8 @@ { - "id": 214018468, - "node_id": "MDEwOlJlcG9zaXRvcnkyMTQwMTg0Njg=", - "name": "temp-getMergeOptions", - "full_name": "github-api-test-org/temp-getMergeOptions", + "id": 253555338, + "node_id": "MDEwOlJlcG9zaXRvcnkyNTM1NTUzMzg=", + "name": "temp-testGetters", + "full_name": "github-api-test-org/temp-testGetters", "private": false, "owner": { "login": "github-api-test-org", @@ -24,53 +24,53 @@ "type": "Organization", "site_admin": false }, - "html_url": "https://github.com/github-api-test-org/temp-getMergeOptions", - "description": "A test repository for testing the github-api project: temp-getMergeOptions", + "html_url": "https://github.com/github-api-test-org/temp-testGetters", + "description": "A test repository for testing the github-api project: temp-testGetters", "fork": false, - "url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions", - "forks_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/forks", - "keys_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/keys{/key_id}", - "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/collaborators{/collaborator}", - "teams_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/teams", - "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/hooks", - "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/issues/events{/number}", - "events_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/events", - "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/assignees{/user}", - "branches_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/branches{/branch}", - "tags_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/tags", - "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/git/blobs{/sha}", - "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/git/tags{/sha}", - "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/git/refs{/sha}", - "trees_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/git/trees{/sha}", - "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/statuses/{sha}", - "languages_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/languages", - "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/stargazers", - "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/contributors", - "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/subscribers", - "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/subscription", - "commits_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/commits{/sha}", - "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/git/commits{/sha}", - "comments_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/comments{/number}", - "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/issues/comments{/number}", - "contents_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/contents/{+path}", - "compare_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/compare/{base}...{head}", - "merges_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/merges", - "archive_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/{archive_format}{/ref}", - "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/downloads", - "issues_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/issues{/number}", - "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/pulls{/number}", - "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/milestones{/number}", - "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/notifications{?since,all,participating}", - "labels_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/labels{/name}", - "releases_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/releases{/id}", - "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-getMergeOptions/deployments", - "created_at": "2019-10-09T20:35:11Z", - "updated_at": "2019-10-09T20:35:16Z", - "pushed_at": "2019-10-09T20:35:13Z", - "git_url": "git://github.com/github-api-test-org/temp-getMergeOptions.git", - "ssh_url": "git@github.com:github-api-test-org/temp-getMergeOptions.git", - "clone_url": "https://github.com/github-api-test-org/temp-getMergeOptions.git", - "svn_url": "https://github.com/github-api-test-org/temp-getMergeOptions", + "url": "https://api.github.com/repos/github-api-test-org/temp-testGetters", + "forks_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/forks", + "keys_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/teams", + "hooks_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/hooks", + "issue_events_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/issues/events{/number}", + "events_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/events", + "assignees_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/assignees{/user}", + "branches_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/branches{/branch}", + "tags_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/tags", + "blobs_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/statuses/{sha}", + "languages_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/languages", + "stargazers_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/stargazers", + "contributors_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/contributors", + "subscribers_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/subscribers", + "subscription_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/subscription", + "commits_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/contents/{+path}", + "compare_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/merges", + "archive_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/downloads", + "issues_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/issues{/number}", + "pulls_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/pulls{/number}", + "milestones_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/milestones{/number}", + "notifications_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/labels{/name}", + "releases_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/releases{/id}", + "deployments_url": "https://api.github.com/repos/github-api-test-org/temp-testGetters/deployments", + "created_at": "2020-04-06T16:31:08Z", + "updated_at": "2020-04-06T16:31:12Z", + "pushed_at": "2020-04-06T16:31:10Z", + "git_url": "git://github.com/github-api-test-org/temp-testGetters.git", + "ssh_url": "git@github.com:github-api-test-org/temp-testGetters.git", + "clone_url": "https://github.com/github-api-test-org/temp-testGetters.git", + "svn_url": "https://github.com/github-api-test-org/temp-testGetters", "homepage": "http://github-api.kohsuke.org/", "size": 0, "stargazers_count": 0, @@ -96,9 +96,11 @@ "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, @@ -120,5 +122,5 @@ "site_admin": false }, "network_count": 0, - "subscribers_count": 4 + "subscribers_count": 7 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/__files/user-1.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/user-1.json similarity index 90% rename from src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/__files/user-1.json rename to src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/user-1.json index 3309be8e1c..b8f76d4ec3 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/__files/user-1.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/__files/user-1.json @@ -24,14 +24,14 @@ "email": "bitwiseman@gmail.com", "hireable": null, "bio": "https://twitter.com/bitwiseman", - "public_repos": 168, - "public_gists": 5, - "followers": 136, + "public_repos": 181, + "public_gists": 7, + "followers": 153, "following": 9, "created_at": "2012-07-11T20:38:33Z", - "updated_at": "2019-09-24T19:32:29Z", - "private_gists": 7, - "total_private_repos": 9, + "updated_at": "2020-04-05T15:30:16Z", + "private_gists": 8, + "total_private_repos": 10, "owned_private_repos": 0, "disk_usage": 33697, "collaborators": 0, diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/mappings/repos_github-api-test-org_temp-getmergeoptions-2.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/mappings/repos_github-api-test-org_temp-testgetters-2.json similarity index 56% rename from src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/mappings/repos_github-api-test-org_temp-getmergeoptions-2.json rename to src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/mappings/repos_github-api-test-org_temp-testgetters-2.json index 0b1ffd99a4..efaaa0a58c 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/mappings/repos_github-api-test-org_temp-getmergeoptions-2.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/mappings/repos_github-api-test-org_temp-testgetters-2.json @@ -1,8 +1,8 @@ { - "id": "cb893c1a-1c74-4838-b473-342f8c2b8262", - "name": "repos_github-api-test-org_temp-getmergeoptions", + "id": "51e75a28-dbf0-40f0-bd3b-05744a48112f", + "name": "repos_github-api-test-org_temp-testgetters", "request": { - "url": "/repos/github-api-test-org/temp-getMergeOptions", + "url": "/repos/github-api-test-org/temp-testGetters", "method": "GET", "headers": { "Accept": { @@ -12,37 +12,35 @@ }, "response": { "status": 200, - "bodyFileName": "repos_github-api-test-org_temp-getmergeoptions-2.json", + "bodyFileName": "repos_github-api-test-org_temp-testgetters-2.json", "headers": { - "Date": "Wed, 09 Oct 2019 20:35:17 GMT", + "Date": "Mon, 06 Apr 2020 16:31:13 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4779", - "X-RateLimit-Reset": "1570656117", + "X-RateLimit-Remaining": "4946", + "X-RateLimit-Reset": "1586193591", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "W/\"8cf8d178089529a31ec118053dfb2e26\"", - "Last-Modified": "Wed, 09 Oct 2019 20:35:16 GMT", + "ETag": "W/\"907cf28e782c79c9642ee5220a601c46\"", + "Last-Modified": "Mon, 06 Apr 2020 16:31:12 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", - "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": "CC9F:3044:A907C9:1358197:5D9E447F" + "X-GitHub-Request-Id": "C0E8:741A:38FD8:45614:5E8B594B" } }, - "uuid": "cb893c1a-1c74-4838-b473-342f8c2b8262", + "uuid": "51e75a28-dbf0-40f0-bd3b-05744a48112f", "persistent": true, "insertionIndex": 2 } \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/mappings/user-1.json b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/mappings/user-1.json similarity index 63% rename from src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/mappings/user-1.json rename to src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/mappings/user-1.json index 97c288969e..c5260e129f 100644 --- a/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/getMergeOptions/mappings/user-1.json +++ b/src/test/resources/org/kohsuke/github/GHRepositoryTest/wiremock/testGetters/mappings/user-1.json @@ -1,5 +1,5 @@ { - "id": "5d8fe237-9241-4331-8808-0ca2781e48be", + "id": "4594ed8b-ad86-46e5-bdce-92a0089e4cef", "name": "user", "request": { "url": "/user", @@ -14,35 +14,33 @@ "status": 200, "bodyFileName": "user-1.json", "headers": { - "Date": "Wed, 09 Oct 2019 20:35:11 GMT", + "Date": "Mon, 06 Apr 2020 16:31:07 GMT", "Content-Type": "application/json; charset=utf-8", "Server": "GitHub.com", "Status": "200 OK", "X-RateLimit-Limit": "5000", - "X-RateLimit-Remaining": "4787", - "X-RateLimit-Reset": "1570656117", + "X-RateLimit-Remaining": "4951", + "X-RateLimit-Reset": "1586193591", "Cache-Control": "private, max-age=60, s-maxage=60", "Vary": [ "Accept, Authorization, Cookie, X-GitHub-OTP", - "Accept-Encoding" + "Accept-Encoding, Accept, X-Requested-With" ], - "ETag": "W/\"f10545b81d574e5b3170d6ee67e622c7\"", - "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT", + "ETag": "W/\"2bd6b233a833d556f43f68fd5daa36d6\"", + "Last-Modified": "Sun, 05 Apr 2020 15:30:16 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", - "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": "CC9F:3044:A90701:135818B:5D9E447E" + "X-GitHub-Request-Id": "C0E8:741A:38F4E:45610:5E8B594B" } }, - "uuid": "5d8fe237-9241-4331-8808-0ca2781e48be", + "uuid": "4594ed8b-ad86-46e5-bdce-92a0089e4cef", "persistent": true, "insertionIndex": 1 } \ No newline at end of file