-
Notifications
You must be signed in to change notification settings - Fork 25
/
PublishToRubyGemsLibTester.groovy
45 lines (38 loc) · 1.5 KB
/
PublishToRubyGemsLibTester.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*/
import static org.hamcrest.CoreMatchers.notNullValue
import static org.hamcrest.MatcherAssert.assertThat
import static org.hamcrest.CoreMatchers.NullValue
class PublishToRubyGemsLibTester extends LibFunctionTester {
private String gemsDir = 'dist'
private String certPath = 'certs/opensearch-rubygems.pem'
private String apiKeyCredentialId
public PublishToRubyGemsLibTester(String apiKeyCredentialId) {
this.apiKeyCredentialId = apiKeyCredentialId
}
public PublishToRubyGemsLibTester(String apiKeyCredentialId, String gemsDir, String certPath) {
this.apiKeyCredentialId = apiKeyCredentialId
this.gemsDir = gemsDir
this.certPath = certPath
}
void configure(helper, binding){
helper.registerAllowedMethod("withCredentials", [Map])
}
void parameterInvariantsAssertions(call){
assertThat(call.args.gemsDir.toString(), notNullValue())
assertThat(call.args.apiKeyCredentialId.toString(), notNullValue())
assertThat(call.args.certPath.toString(), notNullValue())
}
boolean expectedParametersMatcher(call) {
return call.args.apiKeyCredentialId.first().toString().equals(this.apiKeyCredentialId)
}
String libFunctionName(){
return 'publishToRubyGems'
}
}