Skip to content

Commit 03edacf

Browse files
committed
Enable test for Milestone due date update
1 parent 4802c97 commit 03edacf

17 files changed

+967
-5
lines changed

src/test/java/org/kohsuke/github/GHMilestoneTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import java.io.IOException;
88
import java.util.Date;
9-
import static org.junit.Assert.assertEquals;
109

1110
/**
1211
* @author Martin van Zijl
@@ -37,8 +36,8 @@ public void testUpdateMilestone() throws Exception {
3736

3837
String NEW_TITLE = "Updated Title";
3938
String NEW_DESCRIPTION = "Updated Description";
40-
Date NEW_DUE_DATE = GitHub.parseDate("2020-10-01T13:00:00Z");
41-
Date OUTPUT_DUE_DATE = GitHub.parseDate("2020-10-01T13:00:00Z");
39+
Date NEW_DUE_DATE = GitHub.parseDate("2020-10-05T13:00:00Z");
40+
Date OUTPUT_DUE_DATE = GitHub.parseDate("2020-10-05T07:00:00Z");
4241

4342
milestone.setTitle(NEW_TITLE);
4443
milestone.setDescription(NEW_DESCRIPTION);
@@ -49,8 +48,10 @@ public void testUpdateMilestone() throws Exception {
4948

5049
assertEquals(NEW_TITLE, milestone.getTitle());
5150
assertEquals(NEW_DESCRIPTION, milestone.getDescription());
52-
assertEquals(NEW_DUE_DATE, milestone.getDueOn());
53-
assertNotNull(milestone.getDueOn());
51+
52+
// The time is truncated when sent to the server, but still part of the returned value
53+
// 07:00 midnight PDT
54+
assertEquals(OUTPUT_DUE_DATE, milestone.getDueOn());
5455
}
5556

5657
protected GHRepository getRepository() throws IOException {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"login": "github-api-test-org",
3+
"id": 7544739,
4+
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
5+
"url": "https://api.github.com/orgs/github-api-test-org",
6+
"repos_url": "https://api.github.com/orgs/github-api-test-org/repos",
7+
"events_url": "https://api.github.com/orgs/github-api-test-org/events",
8+
"hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks",
9+
"issues_url": "https://api.github.com/orgs/github-api-test-org/issues",
10+
"members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}",
11+
"public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}",
12+
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
13+
"description": null,
14+
"is_verified": false,
15+
"has_organization_projects": true,
16+
"has_repository_projects": true,
17+
"public_repos": 10,
18+
"public_gists": 0,
19+
"followers": 0,
20+
"following": 0,
21+
"html_url": "https://github.com/github-api-test-org",
22+
"created_at": "2014-05-10T19:39:11Z",
23+
"updated_at": "2015-04-20T00:42:30Z",
24+
"type": "Organization",
25+
"total_private_repos": 0,
26+
"owned_private_repos": 0,
27+
"private_gists": 0,
28+
"disk_usage": 132,
29+
"collaborators": 0,
30+
"billing_email": "kk@kohsuke.org",
31+
"default_repository_permission": "none",
32+
"members_can_create_repositories": false,
33+
"two_factor_requirement_enabled": false,
34+
"plan": {
35+
"name": "free",
36+
"space": 976562499,
37+
"private_repos": 0,
38+
"filled_seats": 7,
39+
"seats": 0
40+
}
41+
}

src/test/resources/org/kohsuke/github/GHMilestoneTest/wiremock/testUpdateMilestone/__files/repos_github-api-test-org_github-api-701999a2-14ad-4078-ab89-b0f722cbc52f.json

Lines changed: 330 additions & 0 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2",
3+
"html_url": "https://github.com/github-api-test-org/github-api/milestone/2",
4+
"labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels",
5+
"id": 4800108,
6+
"node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==",
7+
"number": 2,
8+
"title": "Original Title",
9+
"description": "To test the update methods",
10+
"creator": {
11+
"login": "bitwiseman",
12+
"id": 1958953,
13+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
14+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
15+
"gravatar_id": "",
16+
"url": "https://api.github.com/users/bitwiseman",
17+
"html_url": "https://github.com/bitwiseman",
18+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
19+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
20+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
21+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
22+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
23+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
24+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
25+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
26+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
27+
"type": "User",
28+
"site_admin": false
29+
},
30+
"open_issues": 0,
31+
"closed_issues": 0,
32+
"state": "open",
33+
"created_at": "2019-10-30T22:04:20Z",
34+
"updated_at": "2019-10-30T22:04:20Z",
35+
"due_on": null,
36+
"closed_at": null
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2",
3+
"html_url": "https://github.com/github-api-test-org/github-api/milestone/2",
4+
"labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels",
5+
"id": 4800108,
6+
"node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==",
7+
"number": 2,
8+
"title": "Updated Title",
9+
"description": "To test the update methods",
10+
"creator": {
11+
"login": "bitwiseman",
12+
"id": 1958953,
13+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
14+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
15+
"gravatar_id": "",
16+
"url": "https://api.github.com/users/bitwiseman",
17+
"html_url": "https://github.com/bitwiseman",
18+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
19+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
20+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
21+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
22+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
23+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
24+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
25+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
26+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
27+
"type": "User",
28+
"site_admin": false
29+
},
30+
"open_issues": 0,
31+
"closed_issues": 0,
32+
"state": "open",
33+
"created_at": "2019-10-30T22:04:20Z",
34+
"updated_at": "2019-10-30T22:04:21Z",
35+
"due_on": null,
36+
"closed_at": null
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2",
3+
"html_url": "https://github.com/github-api-test-org/github-api/milestone/2",
4+
"labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels",
5+
"id": 4800108,
6+
"node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==",
7+
"number": 2,
8+
"title": "Updated Title",
9+
"description": "Updated Description",
10+
"creator": {
11+
"login": "bitwiseman",
12+
"id": 1958953,
13+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
14+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
15+
"gravatar_id": "",
16+
"url": "https://api.github.com/users/bitwiseman",
17+
"html_url": "https://github.com/bitwiseman",
18+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
19+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
20+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
21+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
22+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
23+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
24+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
25+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
26+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
27+
"type": "User",
28+
"site_admin": false
29+
},
30+
"open_issues": 0,
31+
"closed_issues": 0,
32+
"state": "open",
33+
"created_at": "2019-10-30T22:04:20Z",
34+
"updated_at": "2019-10-30T22:04:21Z",
35+
"due_on": null,
36+
"closed_at": null
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2",
3+
"html_url": "https://github.com/github-api-test-org/github-api/milestone/2",
4+
"labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels",
5+
"id": 4800108,
6+
"node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==",
7+
"number": 2,
8+
"title": "Updated Title",
9+
"description": "Updated Description",
10+
"creator": {
11+
"login": "bitwiseman",
12+
"id": 1958953,
13+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
14+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
15+
"gravatar_id": "",
16+
"url": "https://api.github.com/users/bitwiseman",
17+
"html_url": "https://github.com/bitwiseman",
18+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
19+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
20+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
21+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
22+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
23+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
24+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
25+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
26+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
27+
"type": "User",
28+
"site_admin": false
29+
},
30+
"open_issues": 0,
31+
"closed_issues": 0,
32+
"state": "open",
33+
"created_at": "2019-10-30T22:04:20Z",
34+
"updated_at": "2019-10-30T22:04:21Z",
35+
"due_on": "2020-10-05T07:00:00Z",
36+
"closed_at": null
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2",
3+
"html_url": "https://github.com/github-api-test-org/github-api/milestone/2",
4+
"labels_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones/2/labels",
5+
"id": 4800108,
6+
"node_id": "MDk6TWlsZXN0b25lNDgwMDEwOA==",
7+
"number": 2,
8+
"title": "Updated Title",
9+
"description": "Updated Description",
10+
"creator": {
11+
"login": "bitwiseman",
12+
"id": 1958953,
13+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
14+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
15+
"gravatar_id": "",
16+
"url": "https://api.github.com/users/bitwiseman",
17+
"html_url": "https://github.com/bitwiseman",
18+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
19+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
20+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
21+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
22+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
23+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
24+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
25+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
26+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
27+
"type": "User",
28+
"site_admin": false
29+
},
30+
"open_issues": 0,
31+
"closed_issues": 0,
32+
"state": "open",
33+
"created_at": "2019-10-30T22:04:20Z",
34+
"updated_at": "2019-10-30T22:04:21Z",
35+
"due_on": "2020-10-05T07:00:00Z",
36+
"closed_at": null
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"login": "bitwiseman",
3+
"id": 1958953,
4+
"node_id": "MDQ6VXNlcjE5NTg5NTM=",
5+
"avatar_url": "https://avatars3.githubusercontent.com/u/1958953?v=4",
6+
"gravatar_id": "",
7+
"url": "https://api.github.com/users/bitwiseman",
8+
"html_url": "https://github.com/bitwiseman",
9+
"followers_url": "https://api.github.com/users/bitwiseman/followers",
10+
"following_url": "https://api.github.com/users/bitwiseman/following{/other_user}",
11+
"gists_url": "https://api.github.com/users/bitwiseman/gists{/gist_id}",
12+
"starred_url": "https://api.github.com/users/bitwiseman/starred{/owner}{/repo}",
13+
"subscriptions_url": "https://api.github.com/users/bitwiseman/subscriptions",
14+
"organizations_url": "https://api.github.com/users/bitwiseman/orgs",
15+
"repos_url": "https://api.github.com/users/bitwiseman/repos",
16+
"events_url": "https://api.github.com/users/bitwiseman/events{/privacy}",
17+
"received_events_url": "https://api.github.com/users/bitwiseman/received_events",
18+
"type": "User",
19+
"site_admin": false,
20+
"name": "Liam Newman",
21+
"company": "Cloudbees, Inc.",
22+
"blog": "",
23+
"location": "Seattle, WA, USA",
24+
"email": "bitwiseman@gmail.com",
25+
"hireable": null,
26+
"bio": "https://twitter.com/bitwiseman",
27+
"public_repos": 169,
28+
"public_gists": 7,
29+
"followers": 139,
30+
"following": 9,
31+
"created_at": "2012-07-11T20:38:33Z",
32+
"updated_at": "2019-09-24T19:32:29Z",
33+
"private_gists": 7,
34+
"total_private_repos": 9,
35+
"owned_private_repos": 0,
36+
"disk_usage": 33697,
37+
"collaborators": 0,
38+
"two_factor_authentication": true,
39+
"plan": {
40+
"name": "free",
41+
"space": 976562499,
42+
"collaborators": 0,
43+
"private_repos": 10000
44+
}
45+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"id": "fdbcaf38-478b-440a-851a-b5913757f6f3",
3+
"name": "orgs_github-api-test-org",
4+
"request": {
5+
"url": "/orgs/github-api-test-org",
6+
"method": "GET"
7+
},
8+
"response": {
9+
"status": 200,
10+
"bodyFileName": "orgs_github-api-test-org-fdbcaf38-478b-440a-851a-b5913757f6f3.json",
11+
"headers": {
12+
"Date": "Wed, 30 Oct 2019 22:04:20 GMT",
13+
"Content-Type": "application/json; charset=utf-8",
14+
"Server": "GitHub.com",
15+
"Status": "200 OK",
16+
"X-RateLimit-Limit": "5000",
17+
"X-RateLimit-Remaining": "4950",
18+
"X-RateLimit-Reset": "1572476616",
19+
"Cache-Control": "private, max-age=60, s-maxage=60",
20+
"Vary": [
21+
"Accept, Authorization, Cookie, X-GitHub-OTP",
22+
"Accept-Encoding"
23+
],
24+
"ETag": "W/\"bbee0a14a82ca84871298052e1bcb545\"",
25+
"Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT",
26+
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
27+
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org",
28+
"X-GitHub-Media-Type": "unknown, github.v3",
29+
"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",
30+
"Access-Control-Allow-Origin": "*",
31+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
32+
"X-Frame-Options": "deny",
33+
"X-Content-Type-Options": "nosniff",
34+
"X-XSS-Protection": "1; mode=block",
35+
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
36+
"Content-Security-Policy": "default-src 'none'",
37+
"X-GitHub-Request-Id": "F2AC:26CD:64AA4:B171A:5DBA08E2"
38+
}
39+
},
40+
"uuid": "fdbcaf38-478b-440a-851a-b5913757f6f3",
41+
"persistent": true,
42+
"insertionIndex": 2
43+
}

0 commit comments

Comments
 (0)