JENKINS-13726: Github plugin should work with Guthub enterprise by allowing for overriding the github URL.

This commit is contained in:
johnou
2013-01-06 00:47:44 +01:00
committed by Johno Crawford
parent 1ba8f2ccbf
commit 35d45ca47d
2 changed files with 46 additions and 3 deletions

View File

@@ -0,0 +1,29 @@
package org.kohsuke.github;
import junit.framework.TestCase;
/**
* Unit test for {@link GitHub}.
*/
public class GitHubTest extends TestCase {
public void testGitHubServerWithHttp() throws Exception {
GitHub hub = GitHub.connect("http://enterprise.kohsuke.org", "kohsuke", "token", "password");
assertEquals("http://enterprise.kohsuke.org/api/v3/test", hub.getApiURL("/test").toString());
}
public void testGitHubServerWithHttps() throws Exception {
GitHub hub = GitHub.connect("https://enterprise.kohsuke.org", "kohsuke", "token", "password");
assertEquals("https://enterprise.kohsuke.org/api/v3/test", hub.getApiURL("/test").toString());
}
public void testGitHubServerWithoutProtocol() throws Exception {
GitHub hub = GitHub.connect("enterprise.kohsuke.org", "kohsuke", "token", "password");
assertEquals("https://enterprise.kohsuke.org/api/v3/test", hub.getApiURL("/test").toString());
}
public void testGitHubServerWithoutServer() throws Exception {
GitHub hub = GitHub.connect("kohsuke", "token", "password");
assertEquals("https://api.github.com/test", hub.getApiURL("/test").toString());
}
}