mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-22 00:11:24 +00:00
Merge pull request #615 from alexanderrtaylor/BranchMissing
Branch missing
This commit is contained in:
@@ -28,7 +28,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD", justification = "Being constructed by JSON deserialization")
|
||||
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
|
||||
justification = "Being constructed by JSON deserialization")
|
||||
class DeleteToken {
|
||||
public String delete_token;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ public class GHAppCreateTokenBuilder {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHAppInstallationToken create() throws IOException {
|
||||
return builder.method("POST").withPreview(MACHINE_MAN).to(apiUrlTail, GHAppInstallationToken.class)
|
||||
return builder.method("POST")
|
||||
.withPreview(MACHINE_MAN)
|
||||
.to(apiUrlTail, GHAppInstallationToken.class)
|
||||
.wrapUp(root);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.JsonMappingException;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
import static org.kohsuke.github.Previews.*;
|
||||
|
||||
@@ -28,6 +30,12 @@ public class GHBranch {
|
||||
private boolean protection;
|
||||
private String protection_url;
|
||||
|
||||
@JsonCreator
|
||||
GHBranch(@JsonProperty(value = "name", required = true) String name) throws Exception {
|
||||
Objects.requireNonNull(name);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The type Commit.
|
||||
*/
|
||||
|
||||
@@ -10,12 +10,50 @@ import java.util.Locale;
|
||||
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
|
||||
*/
|
||||
public enum GHEvent {
|
||||
COMMIT_COMMENT, CREATE, DELETE, DEPLOYMENT, DEPLOYMENT_STATUS, DOWNLOAD, FOLLOW, FORK, FORK_APPLY, GIST, GOLLUM, INSTALLATION, INSTALLATION_REPOSITORIES, INTEGRATION_INSTALLATION_REPOSITORIES, CHECK_SUITE, ISSUE_COMMENT, ISSUES, LABEL, MARKETPLACE_PURCHASE, MEMBER, MEMBERSHIP, MILESTONE, ORGANIZATION, ORG_BLOCK, PAGE_BUILD, PROJECT_CARD, PROJECT_COLUMN, PROJECT, PUBLIC, PULL_REQUEST, PULL_REQUEST_REVIEW, PULL_REQUEST_REVIEW_COMMENT, PUSH, RELEASE, REPOSITORY, // only
|
||||
// valid
|
||||
// for
|
||||
// org
|
||||
// hooks
|
||||
STATUS, TEAM, TEAM_ADD, WATCH, PING,
|
||||
COMMIT_COMMENT,
|
||||
CREATE,
|
||||
DELETE,
|
||||
DEPLOYMENT,
|
||||
DEPLOYMENT_STATUS,
|
||||
DOWNLOAD,
|
||||
FOLLOW,
|
||||
FORK,
|
||||
FORK_APPLY,
|
||||
GIST,
|
||||
GOLLUM,
|
||||
INSTALLATION,
|
||||
INSTALLATION_REPOSITORIES,
|
||||
INTEGRATION_INSTALLATION_REPOSITORIES,
|
||||
CHECK_SUITE,
|
||||
ISSUE_COMMENT,
|
||||
ISSUES,
|
||||
LABEL,
|
||||
MARKETPLACE_PURCHASE,
|
||||
MEMBER,
|
||||
MEMBERSHIP,
|
||||
MILESTONE,
|
||||
ORGANIZATION,
|
||||
ORG_BLOCK,
|
||||
PAGE_BUILD,
|
||||
PROJECT_CARD,
|
||||
PROJECT_COLUMN,
|
||||
PROJECT,
|
||||
PUBLIC,
|
||||
PULL_REQUEST,
|
||||
PULL_REQUEST_REVIEW,
|
||||
PULL_REQUEST_REVIEW_COMMENT,
|
||||
PUSH,
|
||||
RELEASE,
|
||||
REPOSITORY, // only
|
||||
// valid
|
||||
// for
|
||||
// org
|
||||
// hooks
|
||||
STATUS,
|
||||
TEAM,
|
||||
TEAM_ADD,
|
||||
WATCH,
|
||||
PING,
|
||||
/**
|
||||
* Special event type that means "every possible event"
|
||||
*/
|
||||
|
||||
@@ -179,7 +179,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
if (labels == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return Collections.<GHLabel> unmodifiableList(labels);
|
||||
return Collections.<GHLabel>unmodifiableList(labels);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,8 +231,8 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
*/
|
||||
@WithBridgeMethods(void.class)
|
||||
public GHIssueComment comment(String message) throws IOException {
|
||||
GHIssueComment r = new Requester(root).with("body", message).to(getIssuesApiRoute() + "/comments",
|
||||
GHIssueComment.class);
|
||||
GHIssueComment r = new Requester(root).with("body", message)
|
||||
.to(getIssuesApiRoute() + "/comments", GHIssueComment.class);
|
||||
return r.wrapUp(this);
|
||||
}
|
||||
|
||||
@@ -443,22 +443,27 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHIssueComment> listComments() throws IOException {
|
||||
return root.retrieve().asPagedIterable(getIssuesApiRoute() + "/comments", GHIssueComment[].class,
|
||||
item -> item.wrapUp(GHIssue.this));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(getIssuesApiRoute() + "/comments",
|
||||
GHIssueComment[].class,
|
||||
item -> item.wrapUp(GHIssue.this));
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHReaction createReaction(ReactionContent content) throws IOException {
|
||||
return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
|
||||
.to(getApiRoute() + "/reactions", GHReaction.class).wrap(root);
|
||||
return new Requester(owner.root).withPreview(SQUIRREL_GIRL)
|
||||
.with("content", content.getContent())
|
||||
.to(getApiRoute() + "/reactions", GHReaction.class)
|
||||
.wrap(root);
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Deprecated
|
||||
public PagedIterable<GHReaction> listReactions() {
|
||||
return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
|
||||
GHReaction[].class, item -> item.wrap(owner.root));
|
||||
return owner.root.retrieve()
|
||||
.withPreview(SQUIRREL_GIRL)
|
||||
.asPagedIterable(getApiRoute() + "/reactions", GHReaction[].class, item -> item.wrap(owner.root));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,8 +487,10 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void addAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
root.retrieve().method("POST").with(ASSIGNEES, getLogins(assignees)).to(getIssuesApiRoute() + "/assignees",
|
||||
this);
|
||||
root.retrieve()
|
||||
.method("POST")
|
||||
.with(ASSIGNEES, getLogins(assignees))
|
||||
.to(getIssuesApiRoute() + "/assignees", this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -531,7 +538,10 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void removeAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
root.retrieve().method("DELETE").with(ASSIGNEES, getLogins(assignees)).inBody()
|
||||
root.retrieve()
|
||||
.method("DELETE")
|
||||
.with(ASSIGNEES, getLogins(assignees))
|
||||
.inBody()
|
||||
.to(getIssuesApiRoute() + "/assignees", this);
|
||||
}
|
||||
|
||||
@@ -645,8 +655,8 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
/**
|
||||
* The type PullRequest.
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
|
||||
"UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
|
||||
justification = "JSON API")
|
||||
public static class PullRequest {
|
||||
private String diff_url, patch_url, html_url;
|
||||
|
||||
@@ -694,7 +704,9 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHIssueEvent> listEvents() throws IOException {
|
||||
return root.retrieve().asPagedIterable(owner.getApiTailUrl(String.format("/issues/%s/events", number)),
|
||||
GHIssueEvent[].class, item -> item.wrapUp(GHIssue.this));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(owner.getApiTailUrl(String.format("/issues/%s/events", number)),
|
||||
GHIssueEvent[].class,
|
||||
item -> item.wrapUp(GHIssue.this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,8 +392,8 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHPullRequestFileDetail> listFiles() {
|
||||
return root.retrieve().asPagedIterable(String.format("%s/files", getApiRoute()),
|
||||
GHPullRequestFileDetail[].class, null);
|
||||
return root.retrieve()
|
||||
.asPagedIterable(String.format("%s/files", getApiRoute()), GHPullRequestFileDetail[].class, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -402,8 +402,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHPullRequestReview> listReviews() {
|
||||
return root.retrieve().asPagedIterable(String.format("%s/reviews", getApiRoute()), GHPullRequestReview[].class,
|
||||
item -> item.wrapUp(GHPullRequest.this));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(String.format("%s/reviews", getApiRoute()),
|
||||
GHPullRequestReview[].class,
|
||||
item -> item.wrapUp(GHPullRequest.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,8 +416,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* the io exception
|
||||
*/
|
||||
public PagedIterable<GHPullRequestReviewComment> listReviewComments() throws IOException {
|
||||
return root.retrieve().asPagedIterable(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment[].class,
|
||||
item -> item.wrapUp(GHPullRequest.this));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(getApiRoute() + COMMENTS_ACTION,
|
||||
GHPullRequestReviewComment[].class,
|
||||
item -> item.wrapUp(GHPullRequest.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -424,8 +428,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the paged iterable
|
||||
*/
|
||||
public PagedIterable<GHPullRequestCommitDetail> listCommits() {
|
||||
return root.retrieve().asPagedIterable(String.format("%s/commits", getApiRoute()),
|
||||
GHPullRequestCommitDetail[].class, item -> item.wrapUp(GHPullRequest.this));
|
||||
return root.retrieve()
|
||||
.asPagedIterable(String.format("%s/commits", getApiRoute()),
|
||||
GHPullRequestCommitDetail[].class,
|
||||
item -> item.wrapUp(GHPullRequest.this));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -442,7 +448,8 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* the io exception
|
||||
* @deprecated Use {@link #createReview()}
|
||||
*/
|
||||
public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event,
|
||||
public GHPullRequestReview createReview(String body,
|
||||
@CheckForNull GHPullRequestReviewState event,
|
||||
GHPullRequestReviewComment... comments) throws IOException {
|
||||
return createReview(body, event, Arrays.asList(comments));
|
||||
}
|
||||
@@ -461,7 +468,8 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* the io exception
|
||||
* @deprecated Use {@link #createReview()}
|
||||
*/
|
||||
public GHPullRequestReview createReview(String body, @CheckForNull GHPullRequestReviewState event,
|
||||
public GHPullRequestReview createReview(String body,
|
||||
@CheckForNull GHPullRequestReviewState event,
|
||||
List<GHPullRequestReviewComment> comments) throws IOException {
|
||||
GHPullRequestReviewBuilder b = createReview().body(body);
|
||||
for (GHPullRequestReviewComment c : comments) {
|
||||
@@ -496,8 +504,12 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
*/
|
||||
public GHPullRequestReviewComment createReviewComment(String body, String sha, String path, int position)
|
||||
throws IOException {
|
||||
return new Requester(root).method("POST").with("body", body).with("commit_id", sha).with("path", path)
|
||||
.with("position", position).to(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment.class)
|
||||
return new Requester(root).method("POST")
|
||||
.with("body", body)
|
||||
.with("commit_id", sha)
|
||||
.with("path", path)
|
||||
.with("position", position)
|
||||
.to(getApiRoute() + COMMENTS_ACTION, GHPullRequestReviewComment.class)
|
||||
.wrapUp(this);
|
||||
}
|
||||
|
||||
@@ -510,7 +522,8 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* the io exception
|
||||
*/
|
||||
public void requestReviewers(List<GHUser> reviewers) throws IOException {
|
||||
new Requester(root).method("POST").with("reviewers", getLogins(reviewers))
|
||||
new Requester(root).method("POST")
|
||||
.with("reviewers", getLogins(reviewers))
|
||||
.to(getApiRoute() + REQUEST_REVIEWERS);
|
||||
}
|
||||
|
||||
@@ -575,7 +588,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* the io exception
|
||||
*/
|
||||
public void merge(String msg, String sha, MergeMethod method) throws IOException {
|
||||
new Requester(root).method("PUT").with("commit_message", msg).with("sha", sha).with("merge_method", method)
|
||||
new Requester(root).method("PUT")
|
||||
.with("commit_message", msg)
|
||||
.with("sha", sha)
|
||||
.with("merge_method", method)
|
||||
.to(getApiRoute() + "/merge");
|
||||
}
|
||||
|
||||
|
||||
@@ -723,8 +723,9 @@ class Requester {
|
||||
|
||||
private void setupConnection(URL url) throws IOException {
|
||||
if (LOGGER.isLoggable(FINE)) {
|
||||
LOGGER.log(FINE, "GitHub API request [" + (root.login == null ? "anonymous" : root.login) + "]: " + method
|
||||
+ " " + url.toString());
|
||||
LOGGER.log(FINE,
|
||||
"GitHub API request [" + (root.login == null ? "anonymous" : root.login) + "]: " + method + " "
|
||||
+ url.toString());
|
||||
}
|
||||
uc = root.getConnector().connect(url);
|
||||
|
||||
@@ -811,7 +812,7 @@ class Requester {
|
||||
throw (IOException) new IOException("Failed to deserialize " + data).initCause(e);
|
||||
}
|
||||
if (instance != null) {
|
||||
return setResponseHeaders(MAPPER.readerForUpdating(instance).<T> readValue(data));
|
||||
return setResponseHeaders(MAPPER.readerForUpdating(instance).<T>readValue(data));
|
||||
}
|
||||
return null;
|
||||
} catch (FileNotFoundException e) {
|
||||
@@ -872,8 +873,10 @@ class Requester {
|
||||
// likely to be a network exception (e.g. SSLHandshakeException),
|
||||
// uc.getResponseCode() and any other getter on the response will cause an exception
|
||||
if (LOGGER.isLoggable(FINE))
|
||||
LOGGER.log(FINE, "Silently ignore exception retrieving response code for '" + uc.getURL() + "'"
|
||||
+ " handling exception " + e, e);
|
||||
LOGGER.log(FINE,
|
||||
"Silently ignore exception retrieving response code for '" + uc.getURL() + "'"
|
||||
+ " handling exception " + e,
|
||||
e);
|
||||
throw e;
|
||||
}
|
||||
InputStream es = wrapStream(uc.getErrorStream());
|
||||
|
||||
@@ -504,8 +504,10 @@ public final class ReadOnlyObjects {
|
||||
|
||||
@JsonCreator
|
||||
private GHMetaGettersFinalCreator(@Nonnull @JsonProperty("hooks") List<String> hooks,
|
||||
@Nonnull @JsonProperty("git") List<String> git, @Nonnull @JsonProperty("web") List<String> web,
|
||||
@Nonnull @JsonProperty("api") List<String> api, @Nonnull @JsonProperty("pages") List<String> pages,
|
||||
@Nonnull @JsonProperty("git") List<String> git,
|
||||
@Nonnull @JsonProperty("web") List<String> web,
|
||||
@Nonnull @JsonProperty("api") List<String> api,
|
||||
@Nonnull @JsonProperty("pages") List<String> pages,
|
||||
@Nonnull @JsonProperty("importer") List<String> importer,
|
||||
@JsonProperty("verifiable_password_authentication") boolean verifiablePasswordAuthentication) {
|
||||
this.verifiablePasswordAuthentication = verifiablePasswordAuthentication;
|
||||
|
||||
@@ -26,8 +26,8 @@ public class HookApp {
|
||||
public void doIndex(StaplerRequest req) throws IOException {
|
||||
String str = req.getParameter("payload");
|
||||
// System.out.println(str);
|
||||
GHEventPayload.PullRequest o = GitHub.connect().parseEventPayload(new StringReader(str),
|
||||
GHEventPayload.PullRequest.class);
|
||||
GHEventPayload.PullRequest o = GitHub.connect()
|
||||
.parseEventPayload(new StringReader(str), GHEventPayload.PullRequest.class);
|
||||
// System.out.println(o);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,8 @@ public class GHAppTest extends AbstractGitHubWireMockTest {
|
||||
protected GitHubBuilder getGitHubBuilder() {
|
||||
return super.getGitHubBuilder()
|
||||
// ensure that only JWT will be used against the tests below
|
||||
.withPassword(null, null).withJwtToken("bogus");
|
||||
.withPassword(null, null)
|
||||
.withJwtToken("bogus");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -101,7 +102,8 @@ public class GHAppTest extends AbstractGitHubWireMockTest {
|
||||
permissions.put("metadata", GHPermissionType.READ);
|
||||
|
||||
GHAppInstallationToken installationToken = installation.createToken(permissions)
|
||||
.repositoryIds(Arrays.asList((long) 111111111)).create();
|
||||
.repositoryIds(Arrays.asList((long) 111111111))
|
||||
.create();
|
||||
|
||||
assertThat(installationToken.getToken(), is("bogus"));
|
||||
assertThat(installation.getPermissions(), is(permissions));
|
||||
|
||||
@@ -48,9 +48,14 @@ public class GHBranchProtectionTest extends AbstractGitHubApiTestBase {
|
||||
@Test
|
||||
public void testEnableBranchProtections() throws Exception {
|
||||
// team/user restrictions require an organization repo to test against
|
||||
GHBranchProtection protection = branch.enableProtection().addRequiredChecks("test-status-check")
|
||||
.requireBranchIsUpToDate().requireCodeOwnReviews().dismissStaleReviews().requiredReviewers(2)
|
||||
.includeAdmins().enable();
|
||||
GHBranchProtection protection = branch.enableProtection()
|
||||
.addRequiredChecks("test-status-check")
|
||||
.requireBranchIsUpToDate()
|
||||
.requireCodeOwnReviews()
|
||||
.dismissStaleReviews()
|
||||
.requiredReviewers(2)
|
||||
.includeAdmins()
|
||||
.enable();
|
||||
|
||||
RequiredStatusChecks statusChecks = protection.getRequiredStatusChecks();
|
||||
assertNotNull(statusChecks);
|
||||
|
||||
@@ -73,7 +73,8 @@ public class GHContentIntegrationTest extends AbstractGitHubWireMockTest {
|
||||
@Test
|
||||
public void testCRUDContent() throws Exception {
|
||||
GHContentUpdateResponse created = repo.createContent("this is an awesome file I created\n",
|
||||
"Creating a file for integration tests.", createdFilename);
|
||||
"Creating a file for integration tests.",
|
||||
createdFilename);
|
||||
GHContent createdContent = created.getContent();
|
||||
|
||||
assertNotNull(created.getCommit());
|
||||
|
||||
@@ -14,8 +14,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void commit_comment() throws Exception {
|
||||
GHEventPayload.CommitComment event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.CommitComment.class);
|
||||
GHEventPayload.CommitComment event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.CommitComment.class);
|
||||
assertThat(event.getAction(), is("created"));
|
||||
assertThat(event.getComment().getSHA1(), is("9049f1265b7d61be4a8904a9a27120d2064dab3b"));
|
||||
assertThat(event.getComment().getUser().getLogin(), is("baxterthehacker"));
|
||||
@@ -26,8 +26,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void create() throws Exception {
|
||||
GHEventPayload.Create event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.Create.class);
|
||||
GHEventPayload.Create event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.Create.class);
|
||||
assertThat(event.getRef(), is("0.0.1"));
|
||||
assertThat(event.getRefType(), is("tag"));
|
||||
assertThat(event.getMasterBranch(), is("master"));
|
||||
@@ -39,8 +39,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void delete() throws Exception {
|
||||
GHEventPayload.Delete event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.Delete.class);
|
||||
GHEventPayload.Delete event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.Delete.class);
|
||||
assertThat(event.getRef(), is("simple-tag"));
|
||||
assertThat(event.getRefType(), is("tag"));
|
||||
assertThat(event.getRepository().getName(), is("public-repo"));
|
||||
@@ -50,8 +50,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void deployment() throws Exception {
|
||||
GHEventPayload.Deployment event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.Deployment.class);
|
||||
GHEventPayload.Deployment event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.Deployment.class);
|
||||
assertThat(event.getDeployment().getSha(), is("9049f1265b7d61be4a8904a9a27120d2064dab3b"));
|
||||
assertThat(event.getDeployment().getEnvironment(), is("production"));
|
||||
assertThat(event.getDeployment().getCreator().getLogin(), is("baxterthehacker"));
|
||||
@@ -62,8 +62,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void deployment_status() throws Exception {
|
||||
GHEventPayload.DeploymentStatus event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.DeploymentStatus.class);
|
||||
GHEventPayload.DeploymentStatus event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.DeploymentStatus.class);
|
||||
assertThat(event.getDeploymentStatus().getState(), is(GHDeploymentState.SUCCESS));
|
||||
assertThat(event.getDeploymentStatus().getTargetUrl(), nullValue());
|
||||
assertThat(event.getDeployment().getSha(), is("9049f1265b7d61be4a8904a9a27120d2064dab3b"));
|
||||
@@ -104,8 +104,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void issue_comment() throws Exception {
|
||||
GHEventPayload.IssueComment event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.IssueComment.class);
|
||||
GHEventPayload.IssueComment event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.IssueComment.class);
|
||||
assertThat(event.getAction(), is("created"));
|
||||
assertThat(event.getIssue().getNumber(), is(2));
|
||||
assertThat(event.getIssue().getTitle(), is("Spelling error in the README file"));
|
||||
@@ -156,8 +156,8 @@ public class GHEventPayloadTest {
|
||||
@Test
|
||||
@Payload("public")
|
||||
public void public_() throws Exception {
|
||||
GHEventPayload.Public event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.Public.class);
|
||||
GHEventPayload.Public event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.Public.class);
|
||||
assertThat(event.getRepository().getName(), is("public-repo"));
|
||||
assertThat(event.getRepository().getOwner().getLogin(), is("baxterthehacker"));
|
||||
assertThat(event.getSender().getLogin(), is("baxterthehacker"));
|
||||
@@ -165,8 +165,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void pull_request() throws Exception {
|
||||
GHEventPayload.PullRequest event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.PullRequest.class);
|
||||
GHEventPayload.PullRequest event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.PullRequest.class);
|
||||
assertThat(event.getAction(), is("opened"));
|
||||
assertThat(event.getNumber(), is(1));
|
||||
assertThat(event.getPullRequest().getNumber(), is(1));
|
||||
@@ -198,8 +198,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void pull_request_review() throws Exception {
|
||||
GHEventPayload.PullRequestReview event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.PullRequestReview.class);
|
||||
GHEventPayload.PullRequestReview event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.PullRequestReview.class);
|
||||
assertThat(event.getAction(), is("submitted"));
|
||||
|
||||
assertThat(event.getReview().getId(), is(2626884L));
|
||||
@@ -227,8 +227,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void pull_request_review_comment() throws Exception {
|
||||
GHEventPayload.PullRequestReviewComment event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.PullRequestReviewComment.class);
|
||||
GHEventPayload.PullRequestReviewComment event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.PullRequestReviewComment.class);
|
||||
assertThat(event.getAction(), is("created"));
|
||||
|
||||
assertThat(event.getComment().getBody(), is("Maybe you should use more emojji on this line."));
|
||||
@@ -285,8 +285,8 @@ public class GHEventPayloadTest {
|
||||
|
||||
@Test
|
||||
public void repository() throws Exception {
|
||||
GHEventPayload.Repository event = GitHub.offline().parseEventPayload(payload.asReader(),
|
||||
GHEventPayload.Repository.class);
|
||||
GHEventPayload.Repository event = GitHub.offline()
|
||||
.parseEventPayload(payload.asReader(), GHEventPayload.Repository.class);
|
||||
assertThat(event.getAction(), is("created"));
|
||||
assertThat(event.getRepository().getName(), is("new-repository"));
|
||||
assertThat(event.getRepository().getOwner().getLogin(), is("baxterandthehackers"));
|
||||
|
||||
@@ -21,9 +21,13 @@ public class GHGistUpdaterTest extends AbstractGitHubWireMockTest {
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
GHGistBuilder builder = new GHGistBuilder(gitHub);
|
||||
gist = builder.description("Test for the API").file("unmodified.txt", "Should be unmodified")
|
||||
gist = builder.description("Test for the API")
|
||||
.file("unmodified.txt", "Should be unmodified")
|
||||
// .file("delete-me.txt", "To be deleted")
|
||||
.file("rename-me.py", "print 'hello'").file("update-me.txt", "To be updated").public_(true).create();
|
||||
.file("rename-me.py", "print 'hello'")
|
||||
.file("update-me.txt", "To be updated")
|
||||
.public_(true)
|
||||
.create();
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -42,7 +46,8 @@ public class GHGistUpdaterTest extends AbstractGitHubWireMockTest {
|
||||
GHGist updatedGist = updater.description("Description updated by API")
|
||||
.addFile("new-file.txt", "Added by updater")
|
||||
// .deleteFile("delete-me.txt")
|
||||
.renameFile("rename-me.py", "renamed.py").updateFile("update-me.txt", "Content updated by API")
|
||||
.renameFile("rename-me.py", "renamed.py")
|
||||
.updateFile("update-me.txt", "Content updated by API")
|
||||
.update();
|
||||
|
||||
assertEquals("Description updated by API", updatedGist.getDescription());
|
||||
|
||||
@@ -58,8 +58,8 @@ public class GHHookTest {
|
||||
|
||||
try {
|
||||
// fails because application isn't approved in organisation and you can find it only after doing real call
|
||||
final GHHook hook = repository.createHook("my-hook", singletonMap("url", "http://localhost"),
|
||||
singletonList(GHEvent.PUSH), true);
|
||||
final GHHook hook = repository
|
||||
.createHook("my-hook", singletonMap("url", "http://localhost"), singletonList(GHEvent.PUSH), true);
|
||||
} catch (IOException ex) {
|
||||
assertThat(ex, instanceOf(GHFileNotFoundException.class));
|
||||
final GHFileNotFoundException ghFileNotFoundException = (GHFileNotFoundException) ex;
|
||||
|
||||
@@ -33,8 +33,10 @@ public class GHOrganizationTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
|
||||
GHRepository repository = org.createRepository(GITHUB_API_TEST,
|
||||
"a test repository used to test kohsuke's github-api", "http://github-api.kohsuke.org/",
|
||||
"Core Developers", true);
|
||||
"a test repository used to test kohsuke's github-api",
|
||||
"http://github-api.kohsuke.org/",
|
||||
"Core Developers",
|
||||
true);
|
||||
Assert.assertNotNull(repository);
|
||||
}
|
||||
|
||||
@@ -45,7 +47,9 @@ public class GHOrganizationTest extends AbstractGitHubWireMockTest {
|
||||
GHOrganization org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
|
||||
GHRepository repository = org.createRepository(GITHUB_API_TEST)
|
||||
.description("a test repository used to test kohsuke's github-api")
|
||||
.homepage("http://github-api.kohsuke.org/").team(org.getTeamByName("Core Developers")).autoInit(true)
|
||||
.homepage("http://github-api.kohsuke.org/")
|
||||
.team(org.getTeamByName("Core Developers"))
|
||||
.autoInit(true)
|
||||
.create();
|
||||
Assert.assertNotNull(repository);
|
||||
Assert.assertNotNull(repository.getReadme());
|
||||
|
||||
@@ -85,8 +85,10 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
public void pullRequestReviews() throws Exception {
|
||||
String name = "testPullRequestReviews";
|
||||
GHPullRequest p = getRepository().createPullRequest(name, "test/stable", "master", "## test");
|
||||
GHPullRequestReview draftReview = p.createReview().body("Some draft review")
|
||||
.comment("Some niggle", "README.md", 1).create();
|
||||
GHPullRequestReview draftReview = p.createReview()
|
||||
.body("Some draft review")
|
||||
.comment("Some niggle", "README.md", 1)
|
||||
.create();
|
||||
assertThat(draftReview.getState(), is(GHPullRequestReviewState.PENDING));
|
||||
assertThat(draftReview.getBody(), is("Some draft review"));
|
||||
assertThat(draftReview.getCommitId(), notNullValue());
|
||||
@@ -156,13 +158,17 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
int baseRequestCount = mockGitHub.getRequestCount();
|
||||
p.refresh();
|
||||
assertThat("We should not eagerly load organizations for teams",
|
||||
mockGitHub.getRequestCount() - baseRequestCount, equalTo(1));
|
||||
mockGitHub.getRequestCount() - baseRequestCount,
|
||||
equalTo(1));
|
||||
assertThat(p.getRequestedTeams().size(), equalTo(1));
|
||||
assertThat("We should not eagerly load organizations for teams",
|
||||
mockGitHub.getRequestCount() - baseRequestCount, equalTo(1));
|
||||
mockGitHub.getRequestCount() - baseRequestCount,
|
||||
equalTo(1));
|
||||
assertThat("Org should be queried for automatically if asked for",
|
||||
p.getRequestedTeams().get(0).getOrganization(), notNullValue());
|
||||
assertThat("Request count should show lazy load occurred", mockGitHub.getRequestCount() - baseRequestCount,
|
||||
p.getRequestedTeams().get(0).getOrganization(),
|
||||
notNullValue());
|
||||
assertThat("Request count should show lazy load occurred",
|
||||
mockGitHub.getRequestCount() - baseRequestCount,
|
||||
equalTo(2));
|
||||
}
|
||||
|
||||
@@ -224,8 +230,13 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
GHContentUpdateResponse response = getRepository().createContent(name, name, name, branchName);
|
||||
Thread.sleep(1000);
|
||||
|
||||
getRepository().createContent().content(name + name).path(name).branch(branchName).message(name)
|
||||
.sha(response.getContent().getSha()).commit();
|
||||
getRepository().createContent()
|
||||
.content(name + name)
|
||||
.path(name)
|
||||
.branch(branchName)
|
||||
.message(name)
|
||||
.sha(response.getContent().getSha())
|
||||
.commit();
|
||||
GHPullRequest p = getRepository().createPullRequest(name, branchName, "master", "## test squash");
|
||||
Thread.sleep(1000);
|
||||
p.merge("squash merge", null, GHPullRequest.MergeMethod.SQUASH);
|
||||
@@ -239,8 +250,12 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
repo.createPullRequest("queryPullRequestsQualifiedHead_rc", "test/rc", "master", null);
|
||||
|
||||
// Query by one of the heads and make sure we only get that branch's PR back.
|
||||
List<GHPullRequest> prs = repo.queryPullRequests().state(GHIssueState.OPEN)
|
||||
.head("github-api-test-org:test/stable").base("master").list().asList();
|
||||
List<GHPullRequest> prs = repo.queryPullRequests()
|
||||
.state(GHIssueState.OPEN)
|
||||
.head("github-api-test-org:test/stable")
|
||||
.base("master")
|
||||
.list()
|
||||
.asList();
|
||||
assertNotNull(prs);
|
||||
assertEquals(1, prs.size());
|
||||
assertEquals("test/stable", prs.get(0).getHead().getRef());
|
||||
@@ -254,8 +269,12 @@ public class GHPullRequestTest extends AbstractGitHubWireMockTest {
|
||||
repo.createPullRequest("queryPullRequestsUnqualifiedHead_rc", "test/rc", "master", null);
|
||||
|
||||
// Query by one of the heads and make sure we only get that branch's PR back.
|
||||
List<GHPullRequest> prs = repo.queryPullRequests().state(GHIssueState.OPEN).head("test/stable").base("master")
|
||||
.list().asList();
|
||||
List<GHPullRequest> prs = repo.queryPullRequests()
|
||||
.state(GHIssueState.OPEN)
|
||||
.head("test/stable")
|
||||
.base("master")
|
||||
.list()
|
||||
.asList();
|
||||
assertNotNull(prs);
|
||||
assertEquals(1, prs.size());
|
||||
assertEquals("test/stable", prs.get(0).getHead().getRef());
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -8,8 +9,8 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.core.IsInstanceOf.instanceOf;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assume.assumeFalse;
|
||||
|
||||
@@ -49,6 +50,27 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
assertThat(branch.getName(), is("test/#UrlEncode"));
|
||||
}
|
||||
|
||||
// Issue #607
|
||||
@Test
|
||||
public void getBranchNonExistentBut200Status() throws Exception {
|
||||
// Manually changed the returned status to 200 so dont take a new snapshot
|
||||
this.snapshotNotAllowed();
|
||||
|
||||
// This should *never* happen but with mocking it was discovered
|
||||
GHRepository repo = getRepository();
|
||||
try {
|
||||
GHBranch branch = repo.getBranch("test/NonExistent");
|
||||
fail();
|
||||
} catch (Exception e) {
|
||||
// I dont really love this but I wanted to get to the root wrapped cause
|
||||
assertThat(e, instanceOf(IOException.class));
|
||||
assertThat(e.getMessage(),
|
||||
equalTo("Server returned HTTP response code: 200, message: 'OK' for URL: "
|
||||
+ mockGitHub.apiServer().baseUrl()
|
||||
+ "/repos/github-api-test-org/github-api/branches/test%2FNonExistent"));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void subscription() throws Exception {
|
||||
GHRepository r = getRepository();
|
||||
@@ -197,8 +219,11 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
@Test
|
||||
public void searchRepositories() throws Exception {
|
||||
PagedSearchIterable<GHRepository> r = gitHub.searchRepositories().q("tetris").language("assembly")
|
||||
.sort(GHRepositorySearchBuilder.Sort.STARS).list();
|
||||
PagedSearchIterable<GHRepository> r = gitHub.searchRepositories()
|
||||
.q("tetris")
|
||||
.language("assembly")
|
||||
.sort(GHRepositorySearchBuilder.Sort.STARS)
|
||||
.list();
|
||||
GHRepository u = r.iterator().next();
|
||||
// System.out.println(u.getName());
|
||||
assertNotNull(u.getId());
|
||||
@@ -279,7 +304,8 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
topics.add("java");
|
||||
topics.add("api-test-dummy");
|
||||
repo.setTopics(topics);
|
||||
assertThat("Topics retain input order (are not sort when stored)", repo.listTopics(),
|
||||
assertThat("Topics retain input order (are not sort when stored)",
|
||||
repo.listTopics(),
|
||||
contains("java", "api-test-dummy"));
|
||||
|
||||
topics = new ArrayList<>();
|
||||
@@ -287,14 +313,16 @@ public class GHRepositoryTest extends AbstractGitHubWireMockTest {
|
||||
topics.add("api-test-dummy");
|
||||
topics.add("java");
|
||||
repo.setTopics(topics);
|
||||
assertThat("Topics behave as a set and retain order from previous calls", repo.listTopics(),
|
||||
assertThat("Topics behave as a set and retain order from previous calls",
|
||||
repo.listTopics(),
|
||||
contains("java", "api-test-dummy", "ordered-state"));
|
||||
|
||||
topics = new ArrayList<>();
|
||||
topics.add("ordered-state");
|
||||
topics.add("api-test-dummy");
|
||||
repo.setTopics(topics);
|
||||
assertThat("Topics retain order even when some are removed", repo.listTopics(),
|
||||
assertThat("Topics retain order even when some are removed",
|
||||
repo.listTopics(),
|
||||
contains("api-test-dummy", "ordered-state"));
|
||||
|
||||
topics = new ArrayList<>();
|
||||
|
||||
@@ -25,19 +25,30 @@ public class LifecycleTest extends AbstractGitHubApiTestBase {
|
||||
repository.delete();
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
repository = org.createRepository("github-api-test", "a test repository used to test kohsuke's github-api",
|
||||
"http://github-api.kohsuke.org/", "Core Developers", true);
|
||||
repository = org.createRepository("github-api-test",
|
||||
"a test repository used to test kohsuke's github-api",
|
||||
"http://github-api.kohsuke.org/",
|
||||
"Core Developers",
|
||||
true);
|
||||
Thread.sleep(1000); // wait for the repository to become ready
|
||||
|
||||
assertTrue(repository.getReleases().isEmpty());
|
||||
try {
|
||||
GHMilestone milestone = repository.createMilestone("Initial Release", "first one");
|
||||
GHIssue issue = repository.createIssue("Test Issue").body("issue body just for grins").milestone(milestone)
|
||||
.assignee(myself).label("bug").create();
|
||||
GHIssue issue = repository.createIssue("Test Issue")
|
||||
.body("issue body just for grins")
|
||||
.milestone(milestone)
|
||||
.assignee(myself)
|
||||
.label("bug")
|
||||
.create();
|
||||
File repoDir = new File(System.getProperty("java.io.tmpdir"), "github-api-test");
|
||||
delete(repoDir);
|
||||
Git origin = Git.cloneRepository().setBare(false).setURI(repository.getSshUrl()).setDirectory(repoDir)
|
||||
.setCredentialsProvider(getCredentialsProvider(myself)).call();
|
||||
Git origin = Git.cloneRepository()
|
||||
.setBare(false)
|
||||
.setURI(repository.getSshUrl())
|
||||
.setDirectory(repoDir)
|
||||
.setCredentialsProvider(getCredentialsProvider(myself))
|
||||
.call();
|
||||
|
||||
commitTestFile(myself, repoDir, origin);
|
||||
|
||||
@@ -74,8 +85,10 @@ public class LifecycleTest extends AbstractGitHubApiTestBase {
|
||||
}
|
||||
|
||||
private GHRelease createRelease(GHRepository repository) throws IOException {
|
||||
GHRelease builder = repository.createRelease("release_tag").name("Test Release")
|
||||
.body("How exciting! To be able to programmatically create releases is a dream come true!").create();
|
||||
GHRelease builder = repository.createRelease("release_tag")
|
||||
.name("Test Release")
|
||||
.body("How exciting! To be able to programmatically create releases is a dream come true!")
|
||||
.create();
|
||||
List<GHRelease> releases = repository.getReleases();
|
||||
assertEquals(1, releases.size());
|
||||
GHRelease release = releases.get(0);
|
||||
|
||||
@@ -44,7 +44,8 @@ public class PayloadRule implements TestRule {
|
||||
}
|
||||
|
||||
public InputStream asInputStream() throws FileNotFoundException {
|
||||
String name = resourceName.startsWith("/") ? resourceName + type
|
||||
String name = resourceName.startsWith("/")
|
||||
? resourceName + type
|
||||
: testClass.getSimpleName() + "/" + resourceName + type;
|
||||
InputStream stream = testClass.getResourceAsStream(name);
|
||||
if (stream == null) {
|
||||
|
||||
@@ -39,7 +39,7 @@ public class RepositoryMockTest {
|
||||
user2.login = "login2";
|
||||
|
||||
when(iterator.hasNext()).thenReturn(true, false, true);
|
||||
when(iterator.next()).thenReturn(new GHUser[] { user1 }, new GHUser[] { user2 });
|
||||
when(iterator.next()).thenReturn(new GHUser[]{ user1 }, new GHUser[]{ user2 });
|
||||
|
||||
Requester requester = Mockito.mock(Requester.class);
|
||||
when(mockGitHub.retrieve()).thenReturn(requester);
|
||||
|
||||
@@ -91,7 +91,8 @@ public class RepositoryTrafficTest extends AbstractGitHubApiTestBase {
|
||||
|
||||
@Test
|
||||
public void testGetViews() throws IOException {
|
||||
GHRepositoryViewTraffic expectedResult = new GHRepositoryViewTraffic(21523359, 65534,
|
||||
GHRepositoryViewTraffic expectedResult = new GHRepositoryViewTraffic(21523359,
|
||||
65534,
|
||||
Arrays.asList(new GHRepositoryViewTraffic.DailyInfo("2016-10-10T00:00:00Z", 3, 2),
|
||||
new GHRepositoryViewTraffic.DailyInfo("2016-10-11T00:00:00Z", 9, 4),
|
||||
new GHRepositoryViewTraffic.DailyInfo("2016-10-12T00:00:00Z", 27, 8),
|
||||
@@ -112,7 +113,8 @@ public class RepositoryTrafficTest extends AbstractGitHubApiTestBase {
|
||||
|
||||
@Test
|
||||
public void testGetClones() throws IOException {
|
||||
GHRepositoryCloneTraffic expectedResult = new GHRepositoryCloneTraffic(1500, 455,
|
||||
GHRepositoryCloneTraffic expectedResult = new GHRepositoryCloneTraffic(1500,
|
||||
455,
|
||||
Arrays.asList(new GHRepositoryCloneTraffic.DailyInfo("2016-10-10T00:00:00Z", 10, 3),
|
||||
new GHRepositoryCloneTraffic.DailyInfo("2016-10-11T00:00:00Z", 20, 6),
|
||||
new GHRepositoryCloneTraffic.DailyInfo("2016-10-12T00:00:00Z", 30, 5),
|
||||
|
||||
@@ -25,7 +25,8 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
|
||||
assertThat(
|
||||
"GitHub connection believes it is anonymous. Make sure you set GITHUB_OAUTH or both GITHUB_USER and GITHUB_PASSWORD environment variables",
|
||||
gitHub.isAnonymous(), is(false));
|
||||
gitHub.isAnonymous(),
|
||||
is(false));
|
||||
|
||||
assertThat(gitHub.login, not(equalTo(STUBBED_USER_LOGIN)));
|
||||
|
||||
@@ -80,7 +81,7 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
e = ex;
|
||||
}
|
||||
|
||||
assertThat(e, Matchers.<Exception> instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e, Matchers.<Exception>instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(), containsString("Request was not matched"));
|
||||
|
||||
// Invalid repository, without stub - fails 404 when not proxying
|
||||
@@ -92,7 +93,7 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
e = ex;
|
||||
}
|
||||
|
||||
assertThat(e, Matchers.<Exception> instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e, Matchers.<Exception>instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(), containsString("Request was not matched"));
|
||||
}
|
||||
|
||||
@@ -120,9 +121,9 @@ public class WireMockStatusReporterTest extends AbstractGitHubWireMockTest {
|
||||
e = ex;
|
||||
}
|
||||
|
||||
assertThat(e, Matchers.<Exception> instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(), equalTo(
|
||||
"{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/#get\"}"));
|
||||
assertThat(e, Matchers.<Exception>instanceOf(GHFileNotFoundException.class));
|
||||
assertThat(e.getMessage(),
|
||||
equalTo("{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/repos/#get\"}"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -108,7 +108,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(false);
|
||||
OkHttpConnector connector = new OkHttpConnector(client);
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -133,7 +134,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(true);
|
||||
OkHttpConnector connector = new OkHttpConnector(client, -1);
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -163,7 +165,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(true);
|
||||
OkHttpConnector connector = new OkHttpConnector(client, 3);
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -187,7 +190,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
OkHttpClient client = createClient(true);
|
||||
OkHttpConnector connector = new OkHttpConnector(client);
|
||||
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
|
||||
this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
|
||||
.withConnector(connector)
|
||||
.build();
|
||||
|
||||
doTestActions();
|
||||
@@ -207,7 +211,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
|
||||
assertThat("Request Count", getRequestCount(), is(networkRequestCount + userRequestCount));
|
||||
|
||||
// Rate limit must be under this value, but if it wiggles we don't care
|
||||
assertThat("Rate Limit Change", rateLimitBefore.remaining - rateLimitAfter.remaining,
|
||||
assertThat("Rate Limit Change",
|
||||
rateLimitBefore.remaining - rateLimitAfter.remaining,
|
||||
is(lessThanOrEqualTo(rateLimitUsed + userRequestCount)));
|
||||
|
||||
}
|
||||
|
||||
@@ -94,11 +94,15 @@ public class GitHubWireMockRule extends WireMockMultiServerRule {
|
||||
protected void after() {
|
||||
super.after();
|
||||
if (isTakeSnapshot()) {
|
||||
this.apiServer().snapshotRecord(recordSpec().forTarget("https://api.github.com")
|
||||
.captureHeader("If-None-Match").extractTextBodiesOver(255));
|
||||
this.apiServer()
|
||||
.snapshotRecord(recordSpec().forTarget("https://api.github.com")
|
||||
.captureHeader("If-None-Match")
|
||||
.extractTextBodiesOver(255));
|
||||
|
||||
this.rawServer().snapshotRecord(recordSpec().forTarget("https://raw.githubusercontent.com")
|
||||
.captureHeader("If-None-Match").extractTextBodiesOver(255));
|
||||
this.rawServer()
|
||||
.snapshotRecord(recordSpec().forTarget("https://raw.githubusercontent.com")
|
||||
.captureHeader("If-None-Match")
|
||||
.extractTextBodiesOver(255));
|
||||
|
||||
// After taking the snapshot, format the output
|
||||
formatJsonFiles(new File(this.apiServer().getOptions().filesRoot().getPath()).toPath());
|
||||
@@ -118,7 +122,10 @@ public class GitHubWireMockRule extends WireMockMultiServerRule {
|
||||
|
||||
private void formatJsonFiles(Path path) {
|
||||
// The more consistent we can make the json output the more meaningful it will be.
|
||||
Gson g = new Gson().newBuilder().serializeNulls().disableHtmlEscaping().setPrettyPrinting()
|
||||
Gson g = new Gson().newBuilder()
|
||||
.serializeNulls()
|
||||
.disableHtmlEscaping()
|
||||
.setPrettyPrinting()
|
||||
.registerTypeAdapter(Double.class, new JsonSerializer<Double>() {
|
||||
@Override
|
||||
public JsonElement serialize(Double src, Type typeOfSrc, JsonSerializationContext context) {
|
||||
@@ -128,7 +135,8 @@ public class GitHubWireMockRule extends WireMockMultiServerRule {
|
||||
return new JsonPrimitive(src.longValue());
|
||||
return new JsonPrimitive(src);
|
||||
}
|
||||
}).create();
|
||||
})
|
||||
.create();
|
||||
|
||||
try {
|
||||
Files.walk(path).forEach(filePath -> {
|
||||
|
||||
@@ -88,7 +88,8 @@ public class WireMockMultiServerRule implements MethodRule, TestRule {
|
||||
directoryName += "_" + serverId;
|
||||
}
|
||||
|
||||
final Options localOptions = new WireMockRuleConfiguration(WireMockMultiServerRule.this.options, directoryName,
|
||||
final Options localOptions = new WireMockRuleConfiguration(WireMockMultiServerRule.this.options,
|
||||
directoryName,
|
||||
extensions);
|
||||
|
||||
new File(localOptions.filesRoot().getPath(), "mappings").mkdirs();
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"login": "github-api-test-org",
|
||||
"id": 7544739,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
|
||||
"url": "https://api.github.com/orgs/github-api-test-org",
|
||||
"repos_url": "https://api.github.com/orgs/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/orgs/github-api-test-org/events",
|
||||
"hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks",
|
||||
"issues_url": "https://api.github.com/orgs/github-api-test-org/issues",
|
||||
"members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}",
|
||||
"public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4",
|
||||
"description": null,
|
||||
"is_verified": false,
|
||||
"has_organization_projects": true,
|
||||
"has_repository_projects": true,
|
||||
"public_repos": 10,
|
||||
"public_gists": 0,
|
||||
"followers": 0,
|
||||
"following": 0,
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"created_at": "2014-05-10T19:39:11Z",
|
||||
"updated_at": "2015-04-20T00:42:30Z",
|
||||
"type": "Organization"
|
||||
}
|
||||
@@ -0,0 +1,327 @@
|
||||
{
|
||||
"id": 206888201,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnkyMDY4ODgyMDE=",
|
||||
"name": "github-api",
|
||||
"full_name": "github-api-test-org/github-api",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "github-api-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/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/github-api-test-org/github-api",
|
||||
"description": "Resetting",
|
||||
"fork": true,
|
||||
"url": "https://api.github.com/repos/github-api-test-org/github-api",
|
||||
"forks_url": "https://api.github.com/repos/github-api-test-org/github-api/forks",
|
||||
"keys_url": "https://api.github.com/repos/github-api-test-org/github-api/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/github-api-test-org/github-api/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/github-api-test-org/github-api/teams",
|
||||
"hooks_url": "https://api.github.com/repos/github-api-test-org/github-api/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/github-api-test-org/github-api/events",
|
||||
"assignees_url": "https://api.github.com/repos/github-api-test-org/github-api/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/github-api-test-org/github-api/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/github-api-test-org/github-api/tags",
|
||||
"blobs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/github-api-test-org/github-api/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/github-api-test-org/github-api/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/github-api-test-org/github-api/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/github-api-test-org/github-api/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/github-api-test-org/github-api/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/github-api-test-org/github-api/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/github-api-test-org/github-api/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/github-api-test-org/github-api/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/github-api-test-org/github-api/subscription",
|
||||
"commits_url": "https://api.github.com/repos/github-api-test-org/github-api/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/github-api-test-org/github-api/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/github-api-test-org/github-api/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/github-api-test-org/github-api/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/github-api-test-org/github-api/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/github-api-test-org/github-api/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/github-api-test-org/github-api/merges",
|
||||
"archive_url": "https://api.github.com/repos/github-api-test-org/github-api/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/github-api-test-org/github-api/downloads",
|
||||
"issues_url": "https://api.github.com/repos/github-api-test-org/github-api/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/github-api-test-org/github-api/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/github-api-test-org/github-api/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/github-api-test-org/github-api/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/github-api-test-org/github-api/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/github-api-test-org/github-api/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/github-api-test-org/github-api/deployments",
|
||||
"created_at": "2019-09-06T23:26:04Z",
|
||||
"updated_at": "2019-11-07T22:27:11Z",
|
||||
"pushed_at": "2019-10-21T22:34:49Z",
|
||||
"git_url": "git://github.com/github-api-test-org/github-api.git",
|
||||
"ssh_url": "git@github.com:github-api-test-org/github-api.git",
|
||||
"clone_url": "https://github.com/github-api-test-org/github-api.git",
|
||||
"svn_url": "https://github.com/github-api-test-org/github-api",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 11391,
|
||||
"stargazers_count": 0,
|
||||
"watchers_count": 0,
|
||||
"language": "Java",
|
||||
"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": {
|
||||
"key": "mit",
|
||||
"name": "MIT License",
|
||||
"spdx_id": "MIT",
|
||||
"url": "https://api.github.com/licenses/mit",
|
||||
"node_id": "MDc6TGljZW5zZTEz"
|
||||
},
|
||||
"forks": 0,
|
||||
"open_issues": 0,
|
||||
"watchers": 0,
|
||||
"default_branch": "master",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": true
|
||||
},
|
||||
"organization": {
|
||||
"login": "github-api-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/github-api-test-org",
|
||||
"html_url": "https://github.com/github-api-test-org",
|
||||
"followers_url": "https://api.github.com/users/github-api-test-org/followers",
|
||||
"following_url": "https://api.github.com/users/github-api-test-org/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api-test-org/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api-test-org/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api-test-org/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api-test-org/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api-test-org/repos",
|
||||
"events_url": "https://api.github.com/users/github-api-test-org/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api-test-org/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"parent": {
|
||||
"id": 617210,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=",
|
||||
"name": "github-api",
|
||||
"full_name": "github-api/github-api",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "github-api",
|
||||
"id": 54909825,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api",
|
||||
"html_url": "https://github.com/github-api",
|
||||
"followers_url": "https://api.github.com/users/github-api/followers",
|
||||
"following_url": "https://api.github.com/users/github-api/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api/repos",
|
||||
"events_url": "https://api.github.com/users/github-api/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/github-api/github-api",
|
||||
"description": "Java API for GitHub",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/github-api/github-api",
|
||||
"forks_url": "https://api.github.com/repos/github-api/github-api/forks",
|
||||
"keys_url": "https://api.github.com/repos/github-api/github-api/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/github-api/github-api/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/github-api/github-api/teams",
|
||||
"hooks_url": "https://api.github.com/repos/github-api/github-api/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/github-api/github-api/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/github-api/github-api/events",
|
||||
"assignees_url": "https://api.github.com/repos/github-api/github-api/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/github-api/github-api/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/github-api/github-api/tags",
|
||||
"blobs_url": "https://api.github.com/repos/github-api/github-api/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/github-api/github-api/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/github-api/github-api/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/github-api/github-api/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/github-api/github-api/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/github-api/github-api/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/github-api/github-api/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/github-api/github-api/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/github-api/github-api/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/github-api/github-api/subscription",
|
||||
"commits_url": "https://api.github.com/repos/github-api/github-api/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/github-api/github-api/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/github-api/github-api/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/github-api/github-api/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/github-api/github-api/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/github-api/github-api/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/github-api/github-api/merges",
|
||||
"archive_url": "https://api.github.com/repos/github-api/github-api/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/github-api/github-api/downloads",
|
||||
"issues_url": "https://api.github.com/repos/github-api/github-api/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/github-api/github-api/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/github-api/github-api/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/github-api/github-api/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/github-api/github-api/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/github-api/github-api/deployments",
|
||||
"created_at": "2010-04-19T04:13:03Z",
|
||||
"updated_at": "2019-11-13T17:48:29Z",
|
||||
"pushed_at": "2019-11-13T17:48:26Z",
|
||||
"git_url": "git://github.com/github-api/github-api.git",
|
||||
"ssh_url": "git@github.com:github-api/github-api.git",
|
||||
"clone_url": "https://github.com/github-api/github-api.git",
|
||||
"svn_url": "https://github.com/github-api/github-api",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 15308,
|
||||
"stargazers_count": 579,
|
||||
"watchers_count": 579,
|
||||
"language": "Java",
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": true,
|
||||
"forks_count": 441,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 55,
|
||||
"license": {
|
||||
"key": "mit",
|
||||
"name": "MIT License",
|
||||
"spdx_id": "MIT",
|
||||
"url": "https://api.github.com/licenses/mit",
|
||||
"node_id": "MDc6TGljZW5zZTEz"
|
||||
},
|
||||
"forks": 441,
|
||||
"open_issues": 55,
|
||||
"watchers": 579,
|
||||
"default_branch": "master"
|
||||
},
|
||||
"source": {
|
||||
"id": 617210,
|
||||
"node_id": "MDEwOlJlcG9zaXRvcnk2MTcyMTA=",
|
||||
"name": "github-api",
|
||||
"full_name": "github-api/github-api",
|
||||
"private": false,
|
||||
"owner": {
|
||||
"login": "github-api",
|
||||
"id": 54909825,
|
||||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjU0OTA5ODI1",
|
||||
"avatar_url": "https://avatars3.githubusercontent.com/u/54909825?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/github-api",
|
||||
"html_url": "https://github.com/github-api",
|
||||
"followers_url": "https://api.github.com/users/github-api/followers",
|
||||
"following_url": "https://api.github.com/users/github-api/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/github-api/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/github-api/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/github-api/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/github-api/orgs",
|
||||
"repos_url": "https://api.github.com/users/github-api/repos",
|
||||
"events_url": "https://api.github.com/users/github-api/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/github-api/received_events",
|
||||
"type": "Organization",
|
||||
"site_admin": false
|
||||
},
|
||||
"html_url": "https://github.com/github-api/github-api",
|
||||
"description": "Java API for GitHub",
|
||||
"fork": false,
|
||||
"url": "https://api.github.com/repos/github-api/github-api",
|
||||
"forks_url": "https://api.github.com/repos/github-api/github-api/forks",
|
||||
"keys_url": "https://api.github.com/repos/github-api/github-api/keys{/key_id}",
|
||||
"collaborators_url": "https://api.github.com/repos/github-api/github-api/collaborators{/collaborator}",
|
||||
"teams_url": "https://api.github.com/repos/github-api/github-api/teams",
|
||||
"hooks_url": "https://api.github.com/repos/github-api/github-api/hooks",
|
||||
"issue_events_url": "https://api.github.com/repos/github-api/github-api/issues/events{/number}",
|
||||
"events_url": "https://api.github.com/repos/github-api/github-api/events",
|
||||
"assignees_url": "https://api.github.com/repos/github-api/github-api/assignees{/user}",
|
||||
"branches_url": "https://api.github.com/repos/github-api/github-api/branches{/branch}",
|
||||
"tags_url": "https://api.github.com/repos/github-api/github-api/tags",
|
||||
"blobs_url": "https://api.github.com/repos/github-api/github-api/git/blobs{/sha}",
|
||||
"git_tags_url": "https://api.github.com/repos/github-api/github-api/git/tags{/sha}",
|
||||
"git_refs_url": "https://api.github.com/repos/github-api/github-api/git/refs{/sha}",
|
||||
"trees_url": "https://api.github.com/repos/github-api/github-api/git/trees{/sha}",
|
||||
"statuses_url": "https://api.github.com/repos/github-api/github-api/statuses/{sha}",
|
||||
"languages_url": "https://api.github.com/repos/github-api/github-api/languages",
|
||||
"stargazers_url": "https://api.github.com/repos/github-api/github-api/stargazers",
|
||||
"contributors_url": "https://api.github.com/repos/github-api/github-api/contributors",
|
||||
"subscribers_url": "https://api.github.com/repos/github-api/github-api/subscribers",
|
||||
"subscription_url": "https://api.github.com/repos/github-api/github-api/subscription",
|
||||
"commits_url": "https://api.github.com/repos/github-api/github-api/commits{/sha}",
|
||||
"git_commits_url": "https://api.github.com/repos/github-api/github-api/git/commits{/sha}",
|
||||
"comments_url": "https://api.github.com/repos/github-api/github-api/comments{/number}",
|
||||
"issue_comment_url": "https://api.github.com/repos/github-api/github-api/issues/comments{/number}",
|
||||
"contents_url": "https://api.github.com/repos/github-api/github-api/contents/{+path}",
|
||||
"compare_url": "https://api.github.com/repos/github-api/github-api/compare/{base}...{head}",
|
||||
"merges_url": "https://api.github.com/repos/github-api/github-api/merges",
|
||||
"archive_url": "https://api.github.com/repos/github-api/github-api/{archive_format}{/ref}",
|
||||
"downloads_url": "https://api.github.com/repos/github-api/github-api/downloads",
|
||||
"issues_url": "https://api.github.com/repos/github-api/github-api/issues{/number}",
|
||||
"pulls_url": "https://api.github.com/repos/github-api/github-api/pulls{/number}",
|
||||
"milestones_url": "https://api.github.com/repos/github-api/github-api/milestones{/number}",
|
||||
"notifications_url": "https://api.github.com/repos/github-api/github-api/notifications{?since,all,participating}",
|
||||
"labels_url": "https://api.github.com/repos/github-api/github-api/labels{/name}",
|
||||
"releases_url": "https://api.github.com/repos/github-api/github-api/releases{/id}",
|
||||
"deployments_url": "https://api.github.com/repos/github-api/github-api/deployments",
|
||||
"created_at": "2010-04-19T04:13:03Z",
|
||||
"updated_at": "2019-11-13T17:48:29Z",
|
||||
"pushed_at": "2019-11-13T17:48:26Z",
|
||||
"git_url": "git://github.com/github-api/github-api.git",
|
||||
"ssh_url": "git@github.com:github-api/github-api.git",
|
||||
"clone_url": "https://github.com/github-api/github-api.git",
|
||||
"svn_url": "https://github.com/github-api/github-api",
|
||||
"homepage": "http://github-api.kohsuke.org/",
|
||||
"size": 15308,
|
||||
"stargazers_count": 579,
|
||||
"watchers_count": 579,
|
||||
"language": "Java",
|
||||
"has_issues": true,
|
||||
"has_projects": true,
|
||||
"has_downloads": true,
|
||||
"has_wiki": true,
|
||||
"has_pages": true,
|
||||
"forks_count": 441,
|
||||
"mirror_url": null,
|
||||
"archived": false,
|
||||
"disabled": false,
|
||||
"open_issues_count": 55,
|
||||
"license": {
|
||||
"key": "mit",
|
||||
"name": "MIT License",
|
||||
"spdx_id": "MIT",
|
||||
"url": "https://api.github.com/licenses/mit",
|
||||
"node_id": "MDc6TGljZW5zZTEz"
|
||||
},
|
||||
"forks": 441,
|
||||
"open_issues": 55,
|
||||
"watchers": 579,
|
||||
"default_branch": "master"
|
||||
},
|
||||
"network_count": 441,
|
||||
"subscribers_count": 0
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
{
|
||||
"login": "alexanderrtaylor",
|
||||
"id": 852179,
|
||||
"node_id": "MDQ6VXNlcjg1MjE3OQ==",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/852179?v=4",
|
||||
"gravatar_id": "",
|
||||
"url": "https://api.github.com/users/alexanderrtaylor",
|
||||
"html_url": "https://github.com/alexanderrtaylor",
|
||||
"followers_url": "https://api.github.com/users/alexanderrtaylor/followers",
|
||||
"following_url": "https://api.github.com/users/alexanderrtaylor/following{/other_user}",
|
||||
"gists_url": "https://api.github.com/users/alexanderrtaylor/gists{/gist_id}",
|
||||
"starred_url": "https://api.github.com/users/alexanderrtaylor/starred{/owner}{/repo}",
|
||||
"subscriptions_url": "https://api.github.com/users/alexanderrtaylor/subscriptions",
|
||||
"organizations_url": "https://api.github.com/users/alexanderrtaylor/orgs",
|
||||
"repos_url": "https://api.github.com/users/alexanderrtaylor/repos",
|
||||
"events_url": "https://api.github.com/users/alexanderrtaylor/events{/privacy}",
|
||||
"received_events_url": "https://api.github.com/users/alexanderrtaylor/received_events",
|
||||
"type": "User",
|
||||
"site_admin": false,
|
||||
"name": "Alex Taylor",
|
||||
"company": "Cloudbees",
|
||||
"blog": "",
|
||||
"location": null,
|
||||
"email": null,
|
||||
"hireable": null,
|
||||
"bio": null,
|
||||
"public_repos": 39,
|
||||
"public_gists": 1,
|
||||
"followers": 5,
|
||||
"following": 0,
|
||||
"created_at": "2011-06-15T16:35:58Z",
|
||||
"updated_at": "2019-07-23T14:01:42Z",
|
||||
"private_gists": 1,
|
||||
"total_private_repos": 13,
|
||||
"owned_private_repos": 0,
|
||||
"disk_usage": 265,
|
||||
"collaborators": 0,
|
||||
"two_factor_authentication": true,
|
||||
"plan": {
|
||||
"name": "free",
|
||||
"space": 976562499,
|
||||
"collaborators": 0,
|
||||
"private_repos": 10000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"id": "cadf65cc-4434-4d3a-b4cf-4b1b79272f46",
|
||||
"name": "orgs_github-api-test-org",
|
||||
"request": {
|
||||
"url": "/orgs/github-api-test-org",
|
||||
"method": "GET"
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "orgs_github-api-test-org-cadf65cc-4434-4d3a-b4cf-4b1b79272f46.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Wed, 13 Nov 2019 19:55:40 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4976",
|
||||
"X-RateLimit-Reset": "1573678486",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"ETag": "W/\"46db056d052e79900ccf2bffefb0e863\"",
|
||||
"Last-Modified": "Mon, 20 Apr 2015 00:42:30 GMT",
|
||||
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
|
||||
"X-Accepted-OAuth-Scopes": "admin:org, read:org, repo, user, write:org",
|
||||
"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": "F3E5:680D:1B5AF:4044E:5DCC5FBB"
|
||||
}
|
||||
},
|
||||
"uuid": "cadf65cc-4434-4d3a-b4cf-4b1b79272f46",
|
||||
"persistent": true,
|
||||
"insertionIndex": 2
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"id": "228f0322-215d-487e-9132-17bc4c3bf020",
|
||||
"name": "repos_github-api-test-org_github-api",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/github-api",
|
||||
"method": "GET"
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "repos_github-api-test-org_github-api-228f0322-215d-487e-9132-17bc4c3bf020.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Wed, 13 Nov 2019 19:55:40 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4975",
|
||||
"X-RateLimit-Reset": "1573678486",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"ETag": "W/\"30a14752ec6a3eede9a30843cc286a50\"",
|
||||
"Last-Modified": "Thu, 07 Nov 2019 22:27:11 GMT",
|
||||
"X-OAuth-Scopes": "admin:gpg_key, 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": "F3E5:680D:1B5B8:4048B:5DCC5FBC"
|
||||
}
|
||||
},
|
||||
"uuid": "228f0322-215d-487e-9132-17bc4c3bf020",
|
||||
"persistent": true,
|
||||
"insertionIndex": 3
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
{
|
||||
"id": "b14df6ec-ff32-4838-8b38-934766abd880",
|
||||
"name": "repos_github-api-test-org_github-api_branches_test_nonexistent",
|
||||
"request": {
|
||||
"url": "/repos/github-api-test-org/github-api/branches/test%2FNonExistent",
|
||||
"method": "GET"
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"body": "{\"message\":\"Branch not found\",\"documentation_url\":\"https://developer.github.com/v3/repos/branches/#get-branch\"}",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Wed, 13 Nov 2019 19:55:40 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Status": "404 Not Found",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4974",
|
||||
"X-RateLimit-Reset": "1573678486",
|
||||
"X-OAuth-Scopes": "admin:gpg_key, 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": "F3E5:680D:1B5C1:4049C:5DCC5FBC"
|
||||
}
|
||||
},
|
||||
"uuid": "b14df6ec-ff32-4838-8b38-934766abd880",
|
||||
"persistent": true,
|
||||
"insertionIndex": 4
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"id": "87afc711-0c63-4cc6-96b5-26eb391105de",
|
||||
"name": "user",
|
||||
"request": {
|
||||
"url": "/user",
|
||||
"method": "GET"
|
||||
},
|
||||
"response": {
|
||||
"status": 200,
|
||||
"bodyFileName": "user-87afc711-0c63-4cc6-96b5-26eb391105de.json",
|
||||
"headers": {
|
||||
"Server": "GitHub.com",
|
||||
"Date": "Wed, 13 Nov 2019 19:55:39 GMT",
|
||||
"Content-Type": "application/json; charset=utf-8",
|
||||
"Status": "200 OK",
|
||||
"X-RateLimit-Limit": "5000",
|
||||
"X-RateLimit-Remaining": "4978",
|
||||
"X-RateLimit-Reset": "1573678486",
|
||||
"Cache-Control": "private, max-age=60, s-maxage=60",
|
||||
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP",
|
||||
"ETag": "W/\"38c5719328738c2ec6c612f367ae1b59\"",
|
||||
"Last-Modified": "Tue, 23 Jul 2019 14:01:42 GMT",
|
||||
"X-OAuth-Scopes": "admin:gpg_key, 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": "F3E5:680D:1B592:40447:5DCC5FBB"
|
||||
}
|
||||
},
|
||||
"uuid": "87afc711-0c63-4cc6-96b5-26eb391105de",
|
||||
"persistent": true,
|
||||
"insertionIndex": 1
|
||||
}
|
||||
Reference in New Issue
Block a user