Search in sources :

Example 1 with Status

use of com.google.copybara.git.github.api.Status in project copybara by google.

the class AbstractGithubApiTest method testCreateStatus.

@Test
public void testCreateStatus() throws Exception {
    trainMockPost("/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e", createValidator(TestCreateStatusRequest.class, csr -> csr.getContext().equals("continuous-integration/jenkins") && csr.getState().equals(State.SUCCESS)), getResource("create_status_response_testdata.json"));
    Status response = api.createStatus("octocat/Hello-World", "6dcb09b5b57875f334f61aebed695e2e4193db5e", new CreateStatusRequest(State.SUCCESS, "https://ci.example.com/1000/output", "Build has completed successfully", "continuous-integration/jenkins"));
    assertThat(response.getContext()).isEqualTo("continuous-integration/jenkins");
    assertThat(response.getTargetUrl()).isEqualTo("https://ci.example.com/1000/output");
    assertThat(response.getDescription()).isEqualTo("Build has completed successfully");
    assertThat(response.getState()).isEqualTo(State.SUCCESS);
    assertThat(response.getCreator()).isNotNull();
    assertThat(response.getCreator().getLogin()).isEqualTo("octocat");
}
Also used : GsonFactory(com.google.api.client.json.gson.GsonFactory) GithubApi(com.google.copybara.git.github.api.GithubApi) CombinedStatus(com.google.copybara.git.github.api.CombinedStatus) Review(com.google.copybara.git.github.api.Review) Lists(com.google.common.collect.Lists) State(com.google.copybara.git.github.api.Status.State) ImmutableList(com.google.common.collect.ImmutableList) Assert.fail(org.junit.Assert.fail) GitHubApiTransport(com.google.copybara.git.github.api.GitHubApiTransport) Issue(com.google.copybara.git.github.api.Issue) Profiler(com.google.copybara.profiler.Profiler) Before(org.junit.Before) Label(com.google.copybara.git.github.api.Issue.Label) GitHubApiException(com.google.copybara.git.github.api.GitHubApiException) Files(java.nio.file.Files) Predicate(java.util.function.Predicate) ResponseCode(com.google.copybara.git.github.api.GitHubApiException.ResponseCode) IOException(java.io.IOException) Test(org.junit.Test) Truth.assertThat(com.google.common.truth.Truth.assertThat) Ticker(com.google.common.base.Ticker) CreatePullRequest(com.google.copybara.git.github.api.CreatePullRequest) List(java.util.List) PullRequest(com.google.copybara.git.github.api.PullRequest) Ref(com.google.copybara.git.github.api.Ref) Paths(java.nio.file.Paths) LogProfilerListener(com.google.copybara.profiler.LogProfilerListener) Status(com.google.copybara.git.github.api.Status) CreateStatusRequest(com.google.copybara.git.github.api.CreateStatusRequest) CombinedStatus(com.google.copybara.git.github.api.CombinedStatus) Status(com.google.copybara.git.github.api.Status) CreateStatusRequest(com.google.copybara.git.github.api.CreateStatusRequest) Test(org.junit.Test)

Aggregations

GsonFactory (com.google.api.client.json.gson.GsonFactory)1 Ticker (com.google.common.base.Ticker)1 ImmutableList (com.google.common.collect.ImmutableList)1 Lists (com.google.common.collect.Lists)1 Truth.assertThat (com.google.common.truth.Truth.assertThat)1 CombinedStatus (com.google.copybara.git.github.api.CombinedStatus)1 CreatePullRequest (com.google.copybara.git.github.api.CreatePullRequest)1 CreateStatusRequest (com.google.copybara.git.github.api.CreateStatusRequest)1 GitHubApiException (com.google.copybara.git.github.api.GitHubApiException)1 ResponseCode (com.google.copybara.git.github.api.GitHubApiException.ResponseCode)1 GitHubApiTransport (com.google.copybara.git.github.api.GitHubApiTransport)1 GithubApi (com.google.copybara.git.github.api.GithubApi)1 Issue (com.google.copybara.git.github.api.Issue)1 Label (com.google.copybara.git.github.api.Issue.Label)1 PullRequest (com.google.copybara.git.github.api.PullRequest)1 Ref (com.google.copybara.git.github.api.Ref)1 Review (com.google.copybara.git.github.api.Review)1 Status (com.google.copybara.git.github.api.Status)1 State (com.google.copybara.git.github.api.Status.State)1 LogProfilerListener (com.google.copybara.profiler.LogProfilerListener)1