use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.
the class AuthorizeProjectTest method setup.
@Before
public void setup() {
final GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
security.open();
this.setupUsers(security, USER1, USER2);
security.save();
}
use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.
the class CredentialsTest method createUserAndLogin.
private void createUserAndLogin() {
final GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
security.open();
MockSecurityRealm realm = security.useRealm(MockSecurityRealm.class);
realm.configure(JENKINS_USER);
security.save();
jenkins.login().doLogin(JENKINS_USER);
}
use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.
the class TriggerRemoteBuildsTest method triggerBuildRemotely.
@Test
@Category(SmokeTest.class)
public void triggerBuildRemotely() {
GlobalSecurityConfig sc = new GlobalSecurityConfig(jenkins);
sc.open();
sc.useRealm(ServletSecurityRealm.class);
sc.save();
FreeStyleJob subject = jenkins.jobs.create();
subject.configure();
subject.addParameter(StringParameter.class).setName("ID");
// Trigger builds remotely (e.g., from scripts)")
// TODO move to page area
jenkins.control("/pseudoRemoteTrigger").resolve().findElement(by.xpath("../label")).click();
jenkins.control("/pseudoRemoteTrigger/authToken").fillIn("authToken", "TOKEN");
subject.addShellStep("test 'id_to_pass' = $ID");
subject.save();
FreeStyleJob trigger = jenkins.jobs.create();
trigger.addShellStep("curl " + subject.url.toString() + "buildWithParameters?token=TOKEN\\&ID=id_to_pass");
trigger.save();
trigger.startBuild().shouldSucceed();
subject.getLastBuild().shouldSucceed();
}
use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.
the class ActiveDirectoryTest method wannabe_cannot_login_to_Jenkins_after_AD_security_configured.
@Test
public void wannabe_cannot_login_to_Jenkins_after_AD_security_configured() {
userCanLoginToJenkinsAsAdmin(ENV.getUser());
String userWannabe = ENV.getUser() + "-wannabe";
GlobalSecurityConfig security = saveSecurityConfig(userWannabe);
jenkins.logout();
jenkins.login().doLogin(userWannabe, ENV.getPassword());
security.configure();
assertThat(getElement(by.name("_.domain")), is(nullValue()));
jenkins.login().doLogin(ENV.getUser(), ENV.getPassword());
}
use of org.jenkinsci.test.acceptance.po.GlobalSecurityConfig in project acceptance-test-harness by jenkinsci.
the class ActiveDirectoryTest method saveSecurityConfig.
private GlobalSecurityConfig saveSecurityConfig(String userOrGroupToAddAsAdmin) {
GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
security.configure();
security = ProjectBasedMatrixAuthorizationStrategy.authorizeUserAsAdmin(userOrGroupToAddAsAdmin, security);
security = configSecurityRealm(security);
security.save();
return security;
}
Aggregations