diff options
Diffstat (limited to 'ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util')
-rw-r--r-- | ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java index 00745922..ec3135f1 100644 --- a/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java +++ b/ecomp-sdk/epsdk-fw/src/test/java/org/onap/portalsdk/core/onboarding/util/AuthUtilTest.java @@ -48,6 +48,7 @@ import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mockito; import org.onap.aaf.cadi.CadiWrap; +import org.onap.portalsdk.core.onboarding.crossapi.IPortalRestCentralService; import org.onap.portalsdk.core.onboarding.exception.PortalAPIException; public class AuthUtilTest { @@ -77,29 +78,29 @@ public class AuthUtilTest { @Test(expected = PortalAPIException.class) public void isAccessAllowedExceptionTest() throws PortalAPIException { Map<String, String> appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test1"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test1"); AuthUtil.isAccessAllowed(request, "com.test", appCreds); } @Test public void isAccessAllowedTest() throws PortalAPIException { - Mockito.when(request.getHeader("username")).thenReturn("test"); - Mockito.when(request.getHeader("password")).thenReturn("test1"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_USER)).thenReturn("test"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_PASS)).thenReturn("test1"); Map<String, String> appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test1"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test1"); assertTrue(AuthUtil.isAccessAllowed(request, "com.test", appCreds)); } @Test public void isAccessAllowedFalseTest() throws PortalAPIException { - Mockito.when(request.getHeader("username")).thenReturn("test"); - Mockito.when(request.getHeader("password")).thenReturn("test1"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_USER)).thenReturn("test"); + Mockito.when(request.getHeader(IPortalRestCentralService.CREDENTIALS_PASS)).thenReturn("test1"); Map<String, String> appCreds = new HashMap<>(); - appCreds.put("username", "test"); - appCreds.put("password", "test123"); - appCreds.put("appName", "testApp"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_USER, "test"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_PASS, "test123"); + appCreds.put(IPortalRestCentralService.CREDENTIALS_APP, "testApp"); assertFalse(AuthUtil.isAccessAllowed(request, "com.test", appCreds)); } |