mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-01-18 05:18:24 +02:00
Remove confidential information
This commit is contained in:
parent
cfc3a1528a
commit
d3bfab50f6
@ -9,8 +9,6 @@ class WhitesourceOrgAdminRepository implements Serializable {
|
||||
final internalWhitesource
|
||||
final Map config
|
||||
|
||||
def orgAdminUserKey
|
||||
|
||||
WhitesourceOrgAdminRepository(Script script, Map config) {
|
||||
this.script = script
|
||||
this.config = config
|
||||
@ -83,7 +81,7 @@ class WhitesourceOrgAdminRepository implements Serializable {
|
||||
credentialsId: config.orgAdminUserTokenCredentialsId,
|
||||
variable: 'orgAdminUserKey'
|
||||
)]) {
|
||||
requestBody["userKey"] = orgAdminUserKey
|
||||
requestBody["userKey"] = script.env.orgAdminUserKey
|
||||
def serializedBody = new JsonUtils().jsonToString(requestBody)
|
||||
def params = [
|
||||
url : config.serviceUrl,
|
||||
|
@ -30,8 +30,6 @@ class WhitesourceOrgAdminRepositoryTest extends BasePiperTest {
|
||||
|
||||
@Before
|
||||
void init() throws Exception {
|
||||
nullScript.env['HTTP_PROXY'] = "http://proxy.wdf.sap.corp:8080"
|
||||
|
||||
repository = new WhitesourceOrgAdminRepository(nullScript, [serviceUrl: "http://some.host.whitesource.com/api/", verbose: true])
|
||||
LibraryLoadingTestExecutionListener.prepareObjectInterceptors(repository)
|
||||
}
|
||||
@ -71,4 +69,30 @@ class WhitesourceOrgAdminRepositoryTest extends BasePiperTest {
|
||||
name : 'Correct Name Cloud'
|
||||
])
|
||||
}
|
||||
|
||||
@Test
|
||||
void testHttpWhitesourceInternalCallUserKey() {
|
||||
nullScript.env.orgAdminUserKey = "4711"
|
||||
def config = [ serviceUrl: "http://some.host.whitesource.com/api/", verbose: false, orgAdminUserKey: nullScript.env.orgAdminUserKey]
|
||||
def requestBody = ["someJson" : [ "someObject" : "abcdef" ]]
|
||||
|
||||
def requestParams
|
||||
helper.registerAllowedMethod('httpRequest', [Map], { p ->
|
||||
requestParams = p
|
||||
})
|
||||
|
||||
repository.httpWhitesource(requestBody)
|
||||
|
||||
assertThat(requestParams, is(
|
||||
[
|
||||
url : config.serviceUrl,
|
||||
httpMode : 'POST',
|
||||
acceptType : 'APPLICATION_JSON',
|
||||
contentType: 'APPLICATION_JSON',
|
||||
requestBody: requestBody,
|
||||
quiet : true,
|
||||
userKey : config.orgAdminUserKey
|
||||
]
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user