Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
augustd committed Nov 14, 2024
1 parent ec1fd1d commit cffee4e
Show file tree
Hide file tree
Showing 11 changed files with 1,133 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/test/java/org/kohsuke/github/GHRepositoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import static org.hamcrest.Matchers.*;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
import static org.kohsuke.github.GHVerification.Reason.GPGVERIFY_ERROR;
import static org.kohsuke.github.GHVerification.Reason.UNKNOWN_SIGNATURE_TYPE;
Expand Down Expand Up @@ -520,17 +521,18 @@ public void listContributorsAnon() throws IOException {
boolean kohsuke = false;

for (GHRepository.Contributor c : r.listContributors(true)) {
if (c.getLogin().equals("kohsuke")) {
assertThat(c.getContributions(), greaterThan(0));
if (c.getType().equals("Anonymous")) {
assertEquals(c.getContributions(), 3);
kohsuke = true;
}
if (i++ > 5) {
if (++i > 1) {
break;
}
}

assertThat(kohsuke, is(true));
}

/**
* Gets the permission.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -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": "[email protected]",
"hireable": null,
"bio": "https://twitter.com/bitwiseman",
"public_repos": 167,
"public_gists": 4,
"followers": 136,
"following": 9,
"created_at": "2012-07-11T20:38:33Z",
"updated_at": "2019-09-24T19:32:29Z",
"private_gists": 7,
"total_private_repos": 9,
"owned_private_repos": 0,
"disk_usage": 33697,
"collaborators": 0,
"two_factor_authentication": true,
"plan": {
"name": "free",
"space": 976562499,
"collaborators": 0,
"private_repos": 10000
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"login": "kohsuke",
"id": 50003,
"node_id": "MDQ6VXNlcjUwMDAz",
"avatar_url": "https://avatars.githubusercontent.com/u/50003?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/kohsuke",
"html_url": "https://github.com/kohsuke",
"followers_url": "https://api.github.com/users/kohsuke/followers",
"following_url": "https://api.github.com/users/kohsuke/following{/other_user}",
"gists_url": "https://api.github.com/users/kohsuke/gists{/gist_id}",
"starred_url": "https://api.github.com/users/kohsuke/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/kohsuke/subscriptions",
"organizations_url": "https://api.github.com/users/kohsuke/orgs",
"repos_url": "https://api.github.com/users/kohsuke/repos",
"events_url": "https://api.github.com/users/kohsuke/events{/privacy}",
"received_events_url": "https://api.github.com/users/kohsuke/received_events",
"type": "User",
"site_admin": false,
"name": "Kohsuke Kawaguchi",
"company": "@launchableinc ",
"blog": "https://www.kohsuke.org/",
"location": "San Jose, California",
"email": "[email protected]",
"hireable": null,
"bio": null,
"twitter_username": null,
"public_repos": 265,
"public_gists": 113,
"followers": 1999,
"following": 3,
"created_at": "2009-01-28T18:53:21Z",
"updated_at": "2022-04-10T22:58:15Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"login": "hub4j",
"id": 54909825,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
"url": "https://api.github.com/orgs/hub4j",
"repos_url": "https://api.github.com/orgs/hub4j/repos",
"events_url": "https://api.github.com/orgs/hub4j/events",
"hooks_url": "https://api.github.com/orgs/hub4j/hooks",
"issues_url": "https://api.github.com/orgs/hub4j/issues",
"members_url": "https://api.github.com/orgs/hub4j/members{/member}",
"public_members_url": "https://api.github.com/orgs/hub4j/public_members{/member}",
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
"description": null,
"is_verified": false,
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 1,
"public_gists": 0,
"followers": 0,
"following": 0,
"html_url": "https://github.com/hub4j",
"created_at": "2019-09-04T18:12:34Z",
"updated_at": "2019-09-04T18:12:34Z",
"type": "Organization",
"total_private_repos": 0,
"owned_private_repos": 0,
"private_gists": 0,
"disk_usage": 11899,
"collaborators": 0,
"billing_email": "[email protected]",
"default_repository_permission": "read",
"members_can_create_repositories": true,
"two_factor_requirement_enabled": false,
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 0,
"filled_seats": 2,
"seats": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"id": 617210,
"node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=",
"name": "github-api",
"full_name": "hub4j/github-api",
"private": false,
"owner": {
"login": "hub4j",
"id": 54909825,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hub4j",
"html_url": "https://github.com/hub4j",
"followers_url": "https://api.github.com/users/hub4j/followers",
"following_url": "https://api.github.com/users/hub4j/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j/subscriptions",
"organizations_url": "https://api.github.com/users/hub4j/orgs",
"repos_url": "https://api.github.com/users/hub4j/repos",
"events_url": "https://api.github.com/users/hub4j/events{/privacy}",
"received_events_url": "https://api.github.com/users/hub4j/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/hub4j/github-api",
"description": "Java API for GitHub",
"fork": false,
"url": "https://api.github.com/repos/hub4j/github-api",
"forks_url": "https://api.github.com/repos/hub4j/github-api/forks",
"keys_url": "https://api.github.com/repos/hub4j/github-api/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/hub4j/github-api/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/hub4j/github-api/teams",
"hooks_url": "https://api.github.com/repos/hub4j/github-api/hooks",
"issue_events_url": "https://api.github.com/repos/hub4j/github-api/issues/events{/number}",
"events_url": "https://api.github.com/repos/hub4j/github-api/events",
"assignees_url": "https://api.github.com/repos/hub4j/github-api/assignees{/user}",
"branches_url": "https://api.github.com/repos/hub4j/github-api/branches{/branch}",
"tags_url": "https://api.github.com/repos/hub4j/github-api/tags",
"blobs_url": "https://api.github.com/repos/hub4j/github-api/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/hub4j/github-api/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/hub4j/github-api/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/hub4j/github-api/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/hub4j/github-api/statuses/{sha}",
"languages_url": "https://api.github.com/repos/hub4j/github-api/languages",
"stargazers_url": "https://api.github.com/repos/hub4j/github-api/stargazers",
"contributors_url": "https://api.github.com/repos/hub4j/github-api/contributors?anon=true",
"subscribers_url": "https://api.github.com/repos/hub4j/github-api/subscribers",
"subscription_url": "https://api.github.com/repos/hub4j/github-api/subscription",
"commits_url": "https://api.github.com/repos/hub4j/github-api/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/hub4j/github-api/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/hub4j/github-api/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/hub4j/github-api/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/hub4j/github-api/contents/{+path}",
"compare_url": "https://api.github.com/repos/hub4j/github-api/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/hub4j/github-api/merges",
"archive_url": "https://api.github.com/repos/hub4j/github-api/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/hub4j/github-api/downloads",
"issues_url": "https://api.github.com/repos/hub4j/github-api/issues{/number}",
"pulls_url": "https://api.github.com/repos/hub4j/github-api/pulls{/number}",
"milestones_url": "https://api.github.com/repos/hub4j/github-api/milestones{/number}",
"notifications_url": "https://api.github.com/repos/hub4j/github-api/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/hub4j/github-api/labels{/name}",
"releases_url": "https://api.github.com/repos/hub4j/github-api/releases{/id}",
"deployments_url": "https://api.github.com/repos/hub4j/github-api/deployments",
"created_at": "2010-04-19T04:13:03Z",
"updated_at": "2019-10-03T09:41:10Z",
"pushed_at": "2019-10-02T22:27:45Z",
"git_url": "git://github.com/hub4j/github-api.git",
"ssh_url": "[email protected]:hub4j/github-api.git",
"clone_url": "https://github.com/hub4j/github-api.git",
"svn_url": "https://github.com/hub4j/github-api",
"homepage": "http://github-api.kohsuke.org/",
"size": 11899,
"stargazers_count": 557,
"watchers_count": 557,
"language": "Java",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": true,
"forks_count": 428,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 90,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"forks": 428,
"open_issues": 90,
"watchers": 557,
"default_branch": "main",
"permissions": {
"admin": true,
"push": true,
"pull": true
},
"allow_squash_merge": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
"organization": {
"login": "hub4j",
"id": 54909825,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hub4j",
"html_url": "https://github.com/hub4j",
"followers_url": "https://api.github.com/users/hub4j/followers",
"following_url": "https://api.github.com/users/hub4j/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hub4j/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j/subscriptions",
"organizations_url": "https://api.github.com/users/hub4j/orgs",
"repos_url": "https://api.github.com/users/hub4j/repos",
"events_url": "https://api.github.com/users/hub4j/events{/privacy}",
"received_events_url": "https://api.github.com/users/hub4j/received_events",
"type": "Organization",
"site_admin": false
},
"network_count": 428,
"subscribers_count": 50
}
Loading

0 comments on commit cffee4e

Please sign in to comment.