Search in sources :

Example 1 with GitHubCommit

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

the class AbstractGitHubApiTest method testCommit.

@Test
public void testCommit() throws Exception {
    trainMockGet("/repos/octocat/Hello-World/commits/604aa8e189a6fee605140ebbe4a3c34ad24619d1", // response
    getResource("commit_response_testdata.json"));
    GitHubCommit r = api.getCommit("octocat/Hello-World", "604aa8e189a6fee605140ebbe4a3c34ad24619d1");
    assertThat(r.getSha()).isEqualTo("604aa8e189a6fee605140ebbe4a3c34ad24619d1");
    assertThat(r.getAuthor().getLogin()).isEqualTo("copybara-author");
    assertThat(r.getCommitter().getLogin()).isEqualTo("copybara-committer");
    assertThat(r.getHtmlUrl()).isEqualTo("https://github.com/google/copybara/commit/604aa8e189a6fee605140ebbe4a3c34ad24619d1");
    assertThat(r.getCommit().getMessage()).isEqualTo("" + "Temporal fix to the CI\n" + "\n" + "We use this deprecated flag until we migrate to the new\n" + "non-native rule.\n" + "\n" + "Will properly fix on Monday.\n" + "\n" + "Change-Id: Ia3c35b8ece932b94e0aa4c7a28bd16d35a260970");
    assertThat(r.getCommit().getAuthor().getName()).isEqualTo("The Author");
    assertThat(r.getCommit().getAuthor().getEmail()).isEqualTo("theauthor@example.com");
    assertThat(r.getCommit().getAuthor().getDate()).isEqualTo(ZonedDateTime.parse("2018-12-07T23:36:45Z"));
    assertThat(r.getCommit().getCommitter().getName()).isEqualTo("The Committer");
    assertThat(r.getCommit().getCommitter().getEmail()).isEqualTo("thecommitter@example.com");
    assertThat(r.getCommit().getCommitter().getDate()).isEqualTo(ZonedDateTime.parse("2018-11-07T23:36:45Z"));
}
Also used : GitHubCommit(com.google.copybara.git.github.api.GitHubCommit) Test(org.junit.Test)

Aggregations

GitHubCommit (com.google.copybara.git.github.api.GitHubCommit)1 Test (org.junit.Test)1