use of org.jenkinsci.test.acceptance.plugins.credentials.StringCredentials in project acceptance-test-harness by jenkinsci.
the class CredentialsBindingTest method testTextBinding.
@Test
public void testTextBinding() {
CredentialsPage mc = new CredentialsPage(jenkins, ManagedCredentials.DEFAULT_DOMAIN);
mc.open();
StringCredentials cred = mc.add(StringCredentials.class);
cred.scope.select("GLOBAL");
cred.secret.set(SECRET_TEXT);
mc.create();
FreeStyleJob job = jenkins.jobs.create();
job.configure();
job.check("Use secret text(s) or file(s)");
ManagedCredentialsBinding mcb = new ManagedCredentialsBinding(job);
SecretStringCredentialsBinding cb = mcb.addCredentialBinding(SecretStringCredentialsBinding.class);
cb.variable.set("BINDED_SECRET");
ShellBuildStep shell = job.addBuildStep(ShellBuildStep.class);
shell.command("if [ \"$BINDED_SECRET\" = \"" + SECRET_TEXT + "\" ] \n then \n echo \"" + SECRET_OUTPUT + "\" \n fi");
job.save();
Build b = job.scheduleBuild();
b.shouldSucceed();
assertThat(b.getConsole(), containsString(SECRET_OUTPUT));
}
Aggregations