Skip to content

Commit

Permalink
Update test to check values
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Dec 29, 2020
1 parent 15f7483 commit cf9caa6
Show file tree
Hide file tree
Showing 10 changed files with 612 additions and 428 deletions.
4 changes: 4 additions & 0 deletions src/test/java/org/kohsuke/github/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ public void testCommitShortInfo() throws Exception {
assertEquals(commit.getCommitShortInfo().getMessage(), "doc");
assertFalse(commit.getCommitShortInfo().getVerification().isVerified());
assertEquals(commit.getCommitShortInfo().getVerification().getReason(), GHVerification.Reason.UNSIGNED);
assertThat(commit.getCommitShortInfo().getAuthor().getDate().toInstant().getEpochSecond(),
equalTo(1271650361L));
assertThat(commit.getCommitShortInfo().getCommitter().getDate().toInstant().getEpochSecond(),
equalTo(1271650361L));
}

@Ignore("Needs mocking check")
Expand Down
14 changes: 10 additions & 4 deletions src/test/java/org/kohsuke/github/CommitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.Arrays;
import java.util.List;

import static org.hamcrest.Matchers.equalTo;

/**
* @author Kohsuke Kawaguchi
*/
Expand Down Expand Up @@ -124,9 +126,13 @@ public void commitSignatureVerification() throws Exception {
@Test // issue 883
public void commitDateNotNull() throws Exception {
GHRepository repo = gitHub.getRepository("hub4j/github-api");
GHCommit commit = repo.getCommit("ed4f9c8176866977677c99ac9668a8ce10231bc8");

assertNotNull(commit.getCommitShortInfo().getAuthoredDate());
assertNotNull(commit.getCommitShortInfo().getAuthor().getDate());
GHCommit commit = repo.getCommit("865a49d2e86c24c5777985f0f103e975c4b765b9");

assertThat(commit.getCommitShortInfo().getAuthoredDate().toInstant().getEpochSecond(), equalTo(1609207093L));
assertThat(commit.getCommitShortInfo().getAuthoredDate(),
equalTo(commit.getCommitShortInfo().getAuthor().getDate()));
assertThat(commit.getCommitShortInfo().getCommitDate().toInstant().getEpochSecond(), equalTo(1609207652L));
assertThat(commit.getCommitShortInfo().getCommitDate(),
equalTo(commit.getCommitShortInfo().getCommitter().getDate()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,44 +65,48 @@
"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": "2020-11-28T05:59:13Z",
"pushed_at": "2020-11-27T17:23:57Z",
"updated_at": "2020-12-29T03:54:49Z",
"pushed_at": "2020-12-29T03:54: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": "https://github-api.kohsuke.org/",
"size": 25463,
"stargazers_count": 714,
"watchers_count": 714,
"size": 25580,
"stargazers_count": 725,
"watchers_count": 725,
"language": "Java",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": true,
"forks_count": 511,
"forks_count": 514,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 79,
"open_issues_count": 74,
"license": {
"key": "mit",
"name": "MIT License",
"spdx_id": "MIT",
"url": "https://api.github.com/licenses/mit",
"node_id": "MDc6TGljZW5zZTEz"
},
"forks": 511,
"open_issues": 79,
"watchers": 714,
"forks": 514,
"open_issues": 74,
"watchers": 725,
"default_branch": "master",
"permissions": {
"admin": false,
"push": false,
"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": "hub4j",
"id": 54909825,
Expand All @@ -123,6 +127,6 @@
"type": "Organization",
"site_admin": false
},
"network_count": 511,
"subscribers_count": 47
"network_count": 514,
"subscribers_count": 50
}

Large diffs are not rendered by default.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,34 +1,46 @@
{
"login": "lower-case",
"id": 8265616,
"node_id": "MDQ6VXNlcjgyNjU2MTY=",
"avatar_url": "https://avatars2.githubusercontent.com/u/8265616?v=4",
"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/lower-case",
"html_url": "https://github.com/lower-case",
"followers_url": "https://api.github.com/users/lower-case/followers",
"following_url": "https://api.github.com/users/lower-case/following{/other_user}",
"gists_url": "https://api.github.com/users/lower-case/gists{/gist_id}",
"starred_url": "https://api.github.com/users/lower-case/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/lower-case/subscriptions",
"organizations_url": "https://api.github.com/users/lower-case/orgs",
"repos_url": "https://api.github.com/users/lower-case/repos",
"events_url": "https://api.github.com/users/lower-case/events{/privacy}",
"received_events_url": "https://api.github.com/users/lower-case/received_events",
"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": "Lovekesh Garg",
"company": "IIT Kharagpur",
"name": "Liam Newman",
"company": "Cloudbees, Inc.",
"blog": "",
"location": "Gurgaon, India",
"email": null,
"hireable": true,
"bio": "404 NOT FOUND",
"twitter_username": null,
"public_repos": 3,
"public_gists": 0,
"followers": 14,
"following": 19,
"created_at": "2014-07-25T08:33:03Z",
"updated_at": "2020-11-28T06:12:48Z"
"location": "Seattle, WA, USA",
"email": "[email protected]",
"hireable": null,
"bio": null,
"twitter_username": "bitwiseman",
"public_repos": 199,
"public_gists": 7,
"followers": 174,
"following": 11,
"created_at": "2012-07-11T20:38:33Z",
"updated_at": "2020-12-23T22:23:08Z",
"private_gists": 19,
"total_private_repos": 17,
"owned_private_repos": 0,
"disk_usage": 33700,
"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
@@ -1,5 +1,5 @@
{
"id": "50636dee-5323-45da-991b-65655816c2ab",
"id": "87ba83b3-361d-4fbe-a4c0-1a92c73911e0",
"name": "repos_hub4j_github-api",
"request": {
"url": "/repos/hub4j/github-api",
Expand All @@ -14,7 +14,7 @@
"status": 200,
"bodyFileName": "repos_hub4j_github-api-2.json",
"headers": {
"Date": "Sat, 28 Nov 2020 06:55:47 GMT",
"Date": "Tue, 29 Dec 2020 04:17:02 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
Expand All @@ -24,25 +24,25 @@
"Accept-Encoding, Accept, X-Requested-With",
"Accept-Encoding"
],
"ETag": "W/\"7a660bdf9608771ebc092a07a9d0e098af6bf6d670cde3147fb3dc6f4a46e65f\"",
"Last-Modified": "Sat, 28 Nov 2020 05:59:13 GMT",
"X-OAuth-Scopes": "repo, workflow",
"ETag": "W/\"6fc2ccdf4af0f89cf88fddff7099dd479f7a15b5551d5ced73e3e4e0384b24c6\"",
"Last-Modified": "Tue, 29 Dec 2020 03:54:49 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
"X-GitHub-Media-Type": "unknown, github.v3",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4957",
"X-RateLimit-Reset": "1606547736",
"X-RateLimit-Used": "43",
"X-RateLimit-Remaining": "4966",
"X-RateLimit-Reset": "1609216145",
"X-RateLimit-Used": "34",
"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": "CD16:2B8B:308B5B:3E3446:5FC1F473"
"X-GitHub-Request-Id": "DEAA:85CA:20A7397:284A8E0:5FEAADBD"
}
},
"uuid": "50636dee-5323-45da-991b-65655816c2ab",
"uuid": "87ba83b3-361d-4fbe-a4c0-1a92c73911e0",
"persistent": true,
"insertionIndex": 2
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "58ab9e92-a0cc-465f-9c04-61b15729cd30",
"name": "repos_hub4j_github-api_commits_ed4f9c8176866977677c99ac9668a8ce10231bc8",
"id": "5c1536ce-299a-40b4-ad5a-a21777294471",
"name": "repos_hub4j_github-api_commits_865a49d2e86c24c5777985f0f103e975c4b765b9",
"request": {
"url": "/repos/hub4j/github-api/commits/ed4f9c8176866977677c99ac9668a8ce10231bc8",
"url": "/repos/hub4j/github-api/commits/865a49d2e86c24c5777985f0f103e975c4b765b9",
"method": "GET",
"headers": {
"Accept": {
Expand All @@ -12,9 +12,9 @@
},
"response": {
"status": 200,
"bodyFileName": "repos_hub4j_github-api_commits_ed4f9c8176866977677c99ac9668a8ce10231bc8-4.json",
"bodyFileName": "repos_hub4j_github-api_commits_865a49d2e86c24c5777985f0f103e975c4b765b9-3.json",
"headers": {
"Date": "Sat, 28 Nov 2020 06:57:53 GMT",
"Date": "Tue, 29 Dec 2020 04:17:02 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
Expand All @@ -24,25 +24,25 @@
"Accept-Encoding, Accept, X-Requested-With",
"Accept-Encoding"
],
"ETag": "W/\"4fbc6c7518df46925561f8fa37edf044e9482be4b916416e82991493110d6001\"",
"Last-Modified": "Wed, 25 Nov 2020 14:37:36 GMT",
"X-OAuth-Scopes": "repo, workflow",
"ETag": "W/\"329c39539737a3ce25b0c6fece22145a13b9b0d69604f0fe77d71f562a9130ab\"",
"Last-Modified": "Tue, 29 Dec 2020 02:07:32 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4943",
"X-RateLimit-Reset": "1606547736",
"X-RateLimit-Used": "57",
"X-RateLimit-Remaining": "4965",
"X-RateLimit-Reset": "1609216145",
"X-RateLimit-Used": "35",
"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": "CF73:2B8A:A8D9A:E0943:5FC1F4F1"
"X-GitHub-Request-Id": "DEAA:85CA:20A73A6:284A912:5FEAADBE"
}
},
"uuid": "58ab9e92-a0cc-465f-9c04-61b15729cd30",
"uuid": "5c1536ce-299a-40b4-ad5a-a21777294471",
"persistent": true,
"insertionIndex": 4
"insertionIndex": 3
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "7aac800a-e6b0-46b9-9e6a-17bb85b6b030",
"id": "2d8f404b-6b92-43f5-9edd-a0ecc00dc866",
"name": "user",
"request": {
"url": "/user",
Expand All @@ -14,7 +14,7 @@
"status": 200,
"bodyFileName": "user-1.json",
"headers": {
"Date": "Sat, 28 Nov 2020 06:55:47 GMT",
"Date": "Tue, 29 Dec 2020 04:17:01 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
Expand All @@ -24,25 +24,25 @@
"Accept-Encoding, Accept, X-Requested-With",
"Accept-Encoding"
],
"ETag": "W/\"14aa5672b664d3be9ebec04b4fece56643332a058e940bb5676847bb385a2b10\"",
"Last-Modified": "Sat, 28 Nov 2020 06:12:48 GMT",
"X-OAuth-Scopes": "repo, workflow",
"ETag": "W/\"bb2babcbd8a6f75f8e5bbf778f169fdb662bf030c0f4a81ed94fde38b7c93347\"",
"Last-Modified": "Wed, 23 Dec 2020 22:23:08 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, workflow, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4959",
"X-RateLimit-Reset": "1606547736",
"X-RateLimit-Used": "41",
"X-RateLimit-Remaining": "4968",
"X-RateLimit-Reset": "1609216145",
"X-RateLimit-Used": "32",
"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": "CD16:2B8B:308B51:3E3441:5FC1F472"
"X-GitHub-Request-Id": "DEAA:85CA:20A736D:284A8D5:5FEAADBD"
}
},
"uuid": "7aac800a-e6b0-46b9-9e6a-17bb85b6b030",
"uuid": "2d8f404b-6b92-43f5-9edd-a0ecc00dc866",
"persistent": true,
"insertionIndex": 1
}

0 comments on commit cf9caa6

Please sign in to comment.