Add convenience method to authenticate with app installation tokens;

Convert existing markdown doc to APT due to formatting features;
Replace occurrences of kohsuke user to github-api org where applicable;
Fix repositoryIds method on GHAppCreateTokenBuilder;

Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
This commit is contained in:
Paulo Miguel Almeida
2019-10-30 22:18:12 +13:00
committed by PauloMigAlmeida
parent efb87c5a9e
commit 8a88c14b13
7 changed files with 184 additions and 7 deletions

View File

@@ -46,7 +46,6 @@ public class GitHubConnectionTest extends AbstractGitHubWireMockTest {
GitHub hub = GitHub.connectUsingPassword("kohsuke", "bogus");
assertEquals("https://api.github.com/test", hub.getApiURL("/test").toString());
}
@Test
public void testGitHubBuilderFromEnvironment() throws IOException {
@@ -86,6 +85,17 @@ public class GitHubConnectionTest extends AbstractGitHubWireMockTest {
assertEquals("bogusPassword", builder.password);
assertEquals("bogusEndpoint", builder.endpoint);
}
@Test
public void testGithubBuilderWithAppInstallationToken() throws Exception{
GitHubBuilder builder = new GitHubBuilder().withAppInstallationToken("bogus");
assertEquals("bogus", builder.oauthToken);
assertEquals("", builder.user);
// test authorization header is set as in the RFC6749
GitHub github = builder.build();
assertEquals("token bogus",github.encodedAuthorization);
assertEquals("",github.login);
}
@Test
public void testGitHubRateLimit() throws Exception {