mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
fixed failing unit test
This commit is contained in:
@@ -70,11 +70,6 @@ public class SecurityFilter extends HttpFilter
|
||||
@VisibleForTesting
|
||||
static final String ATTRIBUTE_REMOTE_USER = "principal";
|
||||
|
||||
/** Field description */
|
||||
public static final String URL_AUTHENTICATION = "/api/rest/auth";
|
||||
|
||||
public static final String URLV2_AUTHENTICATION = "/api/rest/v2/auth";
|
||||
|
||||
private final ScmConfiguration configuration;
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -100,14 +100,29 @@ public class SecurityFilterTest {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests filter on authentication endpoint.
|
||||
* Tests filter on authentication endpoint v1.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Test
|
||||
public void testDoOnAuthenticationUrl() throws IOException, ServletException {
|
||||
when(request.getRequestURI()).thenReturn("/scm/api/rest/authentication");
|
||||
public void testDoOnAuthenticationUrlV1() throws IOException, ServletException {
|
||||
checkIfAuthenticationUrlIsPassedThrough("/scm/api/rest/auth/access_token");
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests filter on authentication endpoint v2.
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws ServletException
|
||||
*/
|
||||
@Test
|
||||
public void testDoOnAuthenticationUrlV2() throws IOException, ServletException {
|
||||
checkIfAuthenticationUrlIsPassedThrough("/scm/api/rest/v2/auth/access_token");
|
||||
}
|
||||
|
||||
private void checkIfAuthenticationUrlIsPassedThrough(String uri) throws IOException, ServletException {
|
||||
when(request.getRequestURI()).thenReturn(uri);
|
||||
securityFilter.doFilter(request, response, chain);
|
||||
verify(request, never()).setAttribute(Mockito.anyString(), Mockito.any());
|
||||
verify(chain).doFilter(request, response);
|
||||
|
||||
5
scm.iml
5
scm.iml
@@ -12,5 +12,10 @@
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-all:1.10.19" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.github.cloudogu:ces-build-lib:9aadeeb" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.cloudbees:groovy-cps:1.21" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.guava:guava:11.0.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.codehaus.groovy:groovy-all:2.4.11" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user