Search in sources :

Example 6 with AdminLinkClaPage

use of io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage in project pivotal-cla by pivotalsoftware.

the class AdminLinkClaTests method linkClaValidationLicenseNameRequired.

@Test
public void linkClaValidationLicenseNameRequired() throws Exception {
    AdminLinkClaPage link = AdminLinkClaPage.to(getDriver());
    link = link.link("test/this", "", AdminLinkClaPage.class);
    link.assertRepositories().hasNoErrors().hasValue("test/this");
    link.assertClaName().hasRequiredError();
}
Also used : AdminLinkClaPage(io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage) Test(org.junit.Test)

Example 7 with AdminLinkClaPage

use of io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage in project pivotal-cla by pivotalsoftware.

the class AuthenticationTests method userUrlWithAdminUserThenAdminUrl.

@SuppressWarnings("unchecked")
@Test
public void userUrlWithAdminUserThenAdminUrl() throws Exception {
    User currentUser = WithAdminUserFactory.create();
    currentUser.setAdmin(false);
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    when(mockGitHub.getCurrentUser(any(CurrentUserRequest.class))).thenAnswer(new Answer<User>() {

        @Override
        public User answer(InvocationOnMock invocation) throws Throwable {
            CurrentUserRequest request = invocation.getArgumentAt(0, CurrentUserRequest.class);
            User currentUser = WithAdminUserFactory.create();
            currentUser.setAdmin(request.isRequestAdminAccess());
            return currentUser;
        }
    });
    when(mockIndividualSignatureRepository.findByEmailIn(anySet())).thenReturn(Collections.emptyList());
    SignClaPage signClaPage = SignClaPage.go(driver, cla.getName());
    signClaPage.assertAt();
    when(mockClaRepository.findAll()).thenReturn(Arrays.asList(cla));
    when(mockGitHub.findRepositoryNamesWithAdminPermission(anyString())).thenReturn(Arrays.asList("test/this"));
    AdminLinkClaPage admin = AdminLinkClaPage.to(driver);
    admin.assertAt();
    ArgumentCaptor<CurrentUserRequest> userCaptor = ArgumentCaptor.forClass(CurrentUserRequest.class);
    verify(mockGitHub, times(2)).getCurrentUser(userCaptor.capture());
    assertThat(userCaptor.getAllValues()).extracting(CurrentUserRequest::isRequestAdminAccess).containsOnly(false, true);
}
Also used : SignClaPage(io.pivotal.cla.webdriver.pages.SignClaPage) WithSigningUser(io.pivotal.cla.security.WithSigningUser) User(io.pivotal.cla.data.User) InvocationOnMock(org.mockito.invocation.InvocationOnMock) CurrentUserRequest(io.pivotal.cla.service.github.CurrentUserRequest) AdminLinkClaPage(io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage) Test(org.junit.Test)

Example 8 with AdminLinkClaPage

use of io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage in project pivotal-cla by pivotalsoftware.

the class AdminHomeTests method adminUserLinkClaLinkVisible.

@Test
public void adminUserLinkClaLinkVisible() {
    AdminLinkClaPage page = AdminLinkClaPage.to(getDriver());
    page.assertAt();
    page = page.link();
    page.assertAt();
}
Also used : AdminLinkClaPage(io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage) Test(org.junit.Test)

Example 9 with AdminLinkClaPage

use of io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage in project pivotal-cla by pivotalsoftware.

the class AdminLinkClaTests method linkClaValidationRepositoriesRequired.

@Test
public void linkClaValidationRepositoriesRequired() throws Exception {
    AdminLinkClaPage link = AdminLinkClaPage.to(getDriver());
    link = link.link("", cla.getName(), AdminLinkClaPage.class);
    link.assertRepositories().hasRequiredError();
    link.assertClaName().hasNoErrors().hasValue(cla.getName());
}
Also used : AdminLinkClaPage(io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage) Test(org.junit.Test)

Example 10 with AdminLinkClaPage

use of io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage in project pivotal-cla by pivotalsoftware.

the class AdminLinkClaTests method navigateToLinkCla.

@Test
public void navigateToLinkCla() {
    HomePage homePage = HomePage.go(driver);
    AdminLinkClaPage link = homePage.link();
    link.assertAt();
    link.assertClaName().hasOptionTexts(cla.getName());
}
Also used : HomePage(io.pivotal.cla.webdriver.pages.HomePage) AdminLinkClaPage(io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage) Test(org.junit.Test)

Aggregations

AdminLinkClaPage (io.pivotal.cla.webdriver.pages.admin.AdminLinkClaPage)12 Test (org.junit.Test)12 User (io.pivotal.cla.data.User)4 WithSigningUser (io.pivotal.cla.security.WithSigningUser)4 CurrentUserRequest (io.pivotal.cla.service.github.CurrentUserRequest)3 SignClaPage (io.pivotal.cla.webdriver.pages.SignClaPage)2 AccessToken (io.pivotal.cla.data.AccessToken)1 WithAdminUser (io.pivotal.cla.security.WithAdminUser)1 WithClaAuthorUser (io.pivotal.cla.security.WithClaAuthorUser)1 ContributingUrlsResponse (io.pivotal.cla.service.github.ContributingUrlsResponse)1 CreatePullRequestHookRequest (io.pivotal.cla.service.github.CreatePullRequestHookRequest)1 OAuthAccessTokenParams (io.pivotal.cla.service.github.OAuthAccessTokenParams)1 PullRequestStatus (io.pivotal.cla.service.github.PullRequestStatus)1 HomePage (io.pivotal.cla.webdriver.pages.HomePage)1 SignIclaPage (io.pivotal.cla.webdriver.pages.SignIclaPage)1 GitHubLoginPage (io.pivotal.cla.webdriver.pages.github.GitHubLoginPage)1 GitHubPullRequestPage (io.pivotal.cla.webdriver.pages.github.GitHubPullRequestPage)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1