From 179ff1eb0c1ac9eef4d152c47df5cb12a4584c0f Mon Sep 17 00:00:00 2001 From: "Kotta, Shireesha (sk434m)" Date: Fri, 28 Jun 2019 15:27:29 -0400 Subject: PENTEST:Do not display stack trace for the api's Issue-ID: PORTAL-654 PENTEST:Do not display stack trace for the api's and all users info for get_user api Change-Id: I68a4e3c7eba2628363275d63535290034591aa07 Signed-off-by: Kotta, Shireesha (sk434m) --- .../onboarding/crossapi/PortalRestAPIProxyTest.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi') diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java index ce1035e7..897f84a1 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPIProxyTest.java @@ -44,6 +44,7 @@ import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.HashMap; +import java.util.Map; import javax.servlet.ServletException; import javax.servlet.ServletInputStream; @@ -119,7 +120,8 @@ public class PortalRestAPIProxyTest { doPost.setAccessible(true); doGet = portalRestAPIProxyClass.getDeclaredMethod("doGet", new Class[]{HttpServletRequest.class, HttpServletResponse.class}); doGet.setAccessible(true); - Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request)).thenReturn(true); + Map appCredentials = new HashMap<>(); + Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request,appCredentials)).thenReturn(true); } @Test(expected=ServletException.class) @@ -203,14 +205,16 @@ public class PortalRestAPIProxyTest { @Test public void testDoPost_WhenIsAppAuthenticatedIsFalse() throws Exception { - Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request)).thenReturn(false); + Map appCredentials = new HashMap<>(); + Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request,appCredentials)).thenReturn(false); Mockito.when(request.getRequestURI()).thenReturn(""); doPost.invoke(portalRestAPIProxyObj, new Object[] {request, response}); } @Test public void testDoPost_WhenIsAppAuthenticatedThrowException() throws Exception { - Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request)).thenThrow(new PortalAPIException()); + Map appCredentials = new HashMap<>(); + Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request,appCredentials)).thenThrow(new PortalAPIException()); Mockito.when(request.getRequestURI()).thenReturn(""); doPost.invoke(portalRestAPIProxyObj, new Object[] {request, response}); } @@ -285,15 +289,17 @@ public class PortalRestAPIProxyTest { @Test public void testDoGet_WhenIsAppAuthenticatedIsFalse() throws Exception { - Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request)).thenReturn(false); + Map appCredentials = new HashMap<>(); + Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request,appCredentials)).thenReturn(false); Mockito.when(request.getRequestURI()).thenReturn(""); doGet.invoke(portalRestAPIProxyObj, new Object[] {request, response}); } @Test public void testDoGet_WhenIsAppAuthenticatedThrowException() throws Exception { - Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request)).thenThrow(new PortalAPIException()); + Map appCredentials = new HashMap<>(); + Mockito.when(portalRestAPICentralServiceImpl.isAppAuthenticated(request,appCredentials)).thenThrow(new PortalAPIException()); Mockito.when(request.getRequestURI()).thenReturn(""); doGet.invoke(portalRestAPIProxyObj, new Object[] {request, response}); } -} +} \ No newline at end of file -- cgit 1.2.3-korg