Search in sources :

Example 1 with User

use of org.jenkinsci.test.acceptance.po.User in project acceptance-test-harness by jenkinsci.

the class FavoriteTest method shouldBeAbleToFavoriteAJob.

@Test
public void shouldBeAbleToFavoriteAJob() throws Exception {
    jenkins.jobs.create(FreeStyleJob.class, "my-project");
    final GlobalSecurityConfig security = new GlobalSecurityConfig(jenkins);
    security.open();
    MockSecurityRealm realm = security.useRealm(MockSecurityRealm.class);
    realm.configure(USER);
    security.save();
    jenkins.login().doLogin(USER);
    waitFor(by.id("fav_my-project")).click();
    // ensure the project is now a favourite
    waitFor(by.css(".icon-fav-active"));
    final User user = new User(jenkins, USER);
    jenkins.visit(user.getConfigUrl().toString());
    // will fail if the project has not been favourited
    waitFor(by.id("favorites"));
    waitFor(by.id("fav_my-project")).click();
    // ensure the project is no longer a favourite
    waitFor(by.css(".icon-fav-inactive"));
    jenkins.visit(user.getConfigUrl().toString());
    waitFor(driver).until(Matchers.hasContent("Favorites"));
    assertFalse(findIfNotVisible(by.id("favorites")).isDisplayed());
}
Also used : User(org.jenkinsci.test.acceptance.po.User) MockSecurityRealm(org.jenkinsci.test.acceptance.plugins.mock_security_realm.MockSecurityRealm) GlobalSecurityConfig(org.jenkinsci.test.acceptance.po.GlobalSecurityConfig) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 2 with User

use of org.jenkinsci.test.acceptance.po.User in project acceptance-test-harness by jenkinsci.

the class LdapPluginTest method do_not_resolve_email.

@Test
public void do_not_resolve_email() {
    // Given
    LdapDetails details = createDefaults(ldap.get());
    details.setDisableLdapEmailResolver(true);
    useLdapAsSecurityRealm(details);
    // When
    Login login = jenkins.login();
    login.doLogin("jenkins", "root");
    // Then
    assertThat(jenkins, hasLoggedInUser("jenkins"));
    User u = new User(jenkins, "jenkins");
    assertThat(u.mail(), nullValue());
}
Also used : LdapDetails(org.jenkinsci.test.acceptance.plugins.ldap.LdapDetails) User(org.jenkinsci.test.acceptance.po.User) Login(org.jenkinsci.test.acceptance.po.Login) Test(org.junit.Test)

Example 3 with User

use of org.jenkinsci.test.acceptance.po.User in project acceptance-test-harness by jenkinsci.

the class LdapPluginTest method custom_valid_group_membership_filter.

@Test
public void custom_valid_group_membership_filter() {
    // Given
    useLdapAsSecurityRealm(createDefaults(ldap.get()).groupMembershipStrategy(SearchForGroupsLdapGroupMembershipStrategy.class).groupMembershipStrategyParam("memberUid={1}"));
    // When
    Login login = jenkins.login();
    login.doLogin("jenkins", "root");
    User userJenkins = new User(jenkins, "jenkins");
    // Then
    assertThat(userJenkins, isMemberOf("ldap1"));
    assertThat(userJenkins, isMemberOf("ldap2"));
}
Also used : User(org.jenkinsci.test.acceptance.po.User) Login(org.jenkinsci.test.acceptance.po.Login) Test(org.junit.Test)

Example 4 with User

use of org.jenkinsci.test.acceptance.po.User in project acceptance-test-harness by jenkinsci.

the class LdapPluginTest method custom_group_search_base.

@Test
public void custom_group_search_base() {
    // Given
    useLdapAsSecurityRealm(createDefaults(ldap.get()).groupSearchBase("ou=Applications"));
    // When
    Login login = jenkins.login();
    login.doLogin("jenkins", "root");
    User userJenkins = new User(jenkins, "jenkins");
    // Then
    assertThat(userJenkins, not(isMemberOf("ldap1")));
    assertThat(userJenkins, not(isMemberOf("ldap2")));
}
Also used : User(org.jenkinsci.test.acceptance.po.User) Login(org.jenkinsci.test.acceptance.po.Login) Test(org.junit.Test)

Example 5 with User

use of org.jenkinsci.test.acceptance.po.User in project acceptance-test-harness by jenkinsci.

the class LdapPluginTest method custom_mail_filter.

@Test
public void custom_mail_filter() {
    // Given
    useLdapAsSecurityRealm(createDefaults(ldap.get()).mailAdressAttributeName("givenName"));
    // When
    Login login = jenkins.login();
    login.doLogin("jenkins", "root");
    User userJenkins = new User(jenkins, "jenkins");
    // Then
    assertThat(userJenkins, mailAddressIs("givenname@mailaddress.com"));
}
Also used : User(org.jenkinsci.test.acceptance.po.User) Login(org.jenkinsci.test.acceptance.po.Login) Test(org.junit.Test)

Aggregations

User (org.jenkinsci.test.acceptance.po.User)13 Test (org.junit.Test)13 Login (org.jenkinsci.test.acceptance.po.Login)10 AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)3 SmokeTest (org.jenkinsci.test.acceptance.junit.SmokeTest)2 Issue (org.jvnet.hudson.test.Issue)2 LdapDetails (org.jenkinsci.test.acceptance.plugins.ldap.LdapDetails)1 MockSecurityRealm (org.jenkinsci.test.acceptance.plugins.mock_security_realm.MockSecurityRealm)1 GlobalSecurityConfig (org.jenkinsci.test.acceptance.po.GlobalSecurityConfig)1