forked from entagen/jenkins-build-per-branch
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request entagen#40 from conceptboard/upstream-feature/supp…
…ort-self-signed-certs support for self signed certs * conceptboard/upstream-feature/support-self-signed-certs: fixed bug for post call in JenkinsApi fixed wrong type for boolean property added shortopt to allow-selfsigned-ssl-certs adding support for self signed certificates
- Loading branch information
Showing
5 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/test/groovy/com/entagen/jenkins/JenkinsApiSSLTest.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.entagen.jenkins | ||
|
||
import org.junit.Test | ||
import groovy.mock.interceptor.MockFor | ||
import org.apache.http.client.HttpResponseException | ||
import groovyx.net.http.RESTClient | ||
import net.sf.json.JSON | ||
import net.sf.json.JSONObject | ||
|
||
class JenkinsApiSSLTest extends GroovyTestCase { | ||
|
||
private String getJenkinsServerUrl(){ | ||
return System.getProperty("jenkinsUrl") ?: "http://localhost:9090/jenkins" | ||
} | ||
|
||
@Test public void testGetJobNames() { | ||
JenkinsApi api = new JenkinsApi(jenkinsServerUrl: getJenkinsServerUrl()) | ||
api.allowSelfsignedSslCerts() | ||
api.getJobNames() | ||
} | ||
|
||
@Test public void testGetJobNamesWithoutSelfsignedSslCerts() { | ||
JenkinsApi api = new JenkinsApi(jenkinsServerUrl: getJenkinsServerUrl()) | ||
if(jenkinsServerUrl.startsWith("https")){ | ||
assert "peer not authenticated" == shouldFail { | ||
api.getJobNames("myproj") | ||
} | ||
} | ||
} | ||
} | ||
|