Skip to content

Commit

Permalink
Put one preview back
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Jun 20, 2024
1 parent 723f8bf commit 6d90891
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/org/kohsuke/github/GitHubRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public B injectMappingValue(@NonNull String name, Object value) {
*/
@Deprecated
public B withPreview(String name) {
return withAccept(name);
return withHeader("Accept", name);
}

/**
Expand All @@ -532,7 +532,7 @@ public B withPreview(Previews preview) {
* @return the b
*/
public B withAccept(String name) {
return withHeader("Accept", name);
return withPreview(name);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/org/kohsuke/github/EnumTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.Test;
import org.kohsuke.github.GHPullRequest.MergeMethod;
import org.kohsuke.github.internal.Previews;

import static org.hamcrest.CoreMatchers.*;

Expand All @@ -18,6 +19,10 @@ public class EnumTest extends AbstractGitHubWireMockTest {
*/
@Test
public void touchEnums() {
// Previews is deprecated but we want to maintain coverage until we remove it
assertThat(Previews.values().length, equalTo(16));
assertThat(Previews.ANTIOPE.mediaType(), equalTo("application/vnd.github.antiope-preview+json"));

assertThat(GHCheckRun.AnnotationLevel.values().length, equalTo(3));
assertThat(GHCheckRun.Conclusion.values().length, equalTo(9));
assertThat(GHCheckRun.Status.values().length, equalTo(4));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"id": 287150018,
"node_id": "MDEwOlJlcG9zaXRvcnkyODcxNTAwMTg=",
"name": "github-api-template-test",
"full_name": "hub4j-test-org/github-api-template-test",
"private": false,
"owner": {
"login": "hub4j-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/hub4j-test-org",
"html_url": "https://github.com/hub4j-test-org",
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/hub4j-test-org/github-api-template-test",
"description": "a test template repository used to test kohsuke's github-api",
"fork": false,
"url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test",
"forks_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/forks",
"keys_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/teams",
"hooks_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/hooks",
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues/events{/number}",
"events_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/events",
"assignees_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/assignees{/user}",
"branches_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/branches{/branch}",
"tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/tags",
"blobs_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/statuses/{sha}",
"languages_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/languages",
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/stargazers",
"contributors_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contributors",
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/subscribers",
"subscription_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/subscription",
"commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/contents/{+path}",
"compare_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/merges",
"archive_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/downloads",
"issues_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/issues{/number}",
"pulls_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/pulls{/number}",
"milestones_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/milestones{/number}",
"notifications_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/labels{/name}",
"releases_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/releases{/id}",
"deployments_url": "https://api.github.com/repos/hub4j-test-org/github-api-template-test/deployments",
"created_at": "2020-08-13T01:15:24Z",
"updated_at": "2020-08-13T01:15:24Z",
"pushed_at": "2020-08-13T01:15:26Z",
"git_url": "git://github.com/hub4j-test-org/github-api-template-test.git",
"ssh_url": "[email protected]:hub4j-test-org/github-api-template-test.git",
"clone_url": "https://github.com/hub4j-test-org/github-api-template-test.git",
"svn_url": "https://github.com/hub4j-test-org/github-api-template-test",
"homepage": "http://github-api.kohsuke.org/",
"size": 0,
"stargazers_count": 0,
"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,
"visibility": "public",
"is_template": true,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "main",
"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,
"template_repository": null,
"organization": {
"login": "hub4j-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/hub4j-test-org",
"html_url": "https://github.com/hub4j-test-org",
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
"type": "Organization",
"site_admin": false
},
"network_count": 0,
"subscribers_count": 8
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@
},
"uuid": "3164c9df-abab-453d-982a-3d446781039d",
"persistent": true,
"scenarioName": "testCreateRepositoryWithParameterIsTemplate-template-repo",
"requiredScenarioState": "Started",
"newScenarioState": "with-template-1",
"insertionIndex": 6
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"id": "51d54e86-a714-457b-88d6-5c045631a074",
"name": "repos_hub4j-test-org_github-api-template-test",
"request": {
"url": "/repos/hub4j-test-org/github-api-template-test",
"method": "GET",
"headers": {
"Accept": {
"equalTo": "application/vnd.github+json"
}
}
},
"response": {
"status": 200,
"bodyFileName": "7-r_h_github-api-template-test.json",
"headers": {
"Date": "Thu, 13 Aug 2020 01:15:27 GMT",
"Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4931",
"X-RateLimit-Reset": "1597282078",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
"Accept-Encoding, Accept, X-Requested-With",
"Accept-Encoding"
],
"ETag": "W/\"9fc368e29d30f2606085100fed431a74\"",
"Last-Modified": "Thu, 13 Aug 2020 01:15:24 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": "github.baptiste-preview; format=json",
"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": "D640:8464:9DD977:C0780E:5F34942F"
}
},
"uuid": "51d54e86-a714-457b-88d6-5c045631a074",
"persistent": true,
"scenarioName": "testCreateRepositoryWithParameterIsTemplate-template-repo",
"requiredScenarioState": "with-template-1",
"newScenarioState": "with-template-2",
"insertionIndex": 7
}

0 comments on commit 6d90891

Please sign in to comment.