mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
JENKINS-13726: Github plugin should work with Guthub enterprise by allowing for overriding the github URL.
This commit is contained in:
29
src/test/java/org/kohsuke/github/GitHubTest.java
Normal file
29
src/test/java/org/kohsuke/github/GitHubTest.java
Normal 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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user