Enable part of AppTest in CI

This commit is contained in:
Liam Newman
2019-10-02 15:17:30 -07:00
parent d096aa2065
commit b35509150a
230 changed files with 17245 additions and 2997 deletions

View File

@@ -41,43 +41,46 @@ public class GitHubTest extends AbstractGitHubApiTestBase {
@Test
public void testGitHubServerWithHttp() throws Exception {
GitHub hub = GitHub.connectToEnterprise("http://enterprise.kohsuke.org/api/v3", "bogus","bogus");
GitHub hub = GitHub.connectToEnterprise("http://enterprise.kohsuke.org/api/v3", "bogus", "bogus");
assertEquals("http://enterprise.kohsuke.org/api/v3/test", hub.getApiURL("/test").toString());
}
@Test
public void testGitHubServerWithHttps() throws Exception {
GitHub hub = GitHub.connectToEnterprise("https://enterprise.kohsuke.org/api/v3", "bogus","bogus");
GitHub hub = GitHub.connectToEnterprise("https://enterprise.kohsuke.org/api/v3", "bogus", "bogus");
assertEquals("https://enterprise.kohsuke.org/api/v3/test", hub.getApiURL("/test").toString());
}
@Test
public void testGitHubServerWithoutServer() throws Exception {
GitHub hub = GitHub.connectUsingPassword("kohsuke", "bogus");
assertEquals("https://api.github.com/test", hub.getApiURL("/test").toString());
}
@Test
public void testGitHubBuilderFromEnvironment() throws IOException {
Map<String, String>props = new HashMap<String, String>();
Map<String, String> props = new HashMap<String, String>();
props.put("login", "bogus");
props.put("oauth", "bogus");
props.put("password", "bogus");
setupEnvironment(props);
GitHubBuilder builder = GitHubBuilder.fromEnvironment();
assertEquals("bogus", builder.user);
assertEquals("bogus", builder.oauthToken);
assertEquals("bogus", builder.password);
}
/*
* Copied from StackOverflow: http://stackoverflow.com/a/7201825/2336755
*
*
* This allows changing the in memory process environment.
*
*
* Its used to wire in values for the github credentials to test that the GitHubBuilder works properly to resolve them.
*/
private void setupEnvironment(Map<String, String> newenv) {
@@ -112,6 +115,7 @@ public class GitHubTest extends AbstractGitHubApiTestBase {
e1.printStackTrace();
}
}
@Test
public void testGitHubBuilderFromCustomEnvironment() throws IOException {
Map<String, String> props = new HashMap<String, String>();
@@ -154,8 +158,8 @@ public class GitHubTest extends AbstractGitHubApiTestBase {
@Test
public void listUsers() throws IOException {
GitHub hub = GitHub.connect();
for (GHUser u : Iterables.limit(hub.listUsers(),10)) {
assert u.getName()!=null;
for (GHUser u : Iterables.limit(hub.listUsers(), 10)) {
assert u.getName() != null;
System.out.println(u.getName());
}
}