diff options
author | Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com> | 2018-07-09 13:41:00 -0400 |
---|---|---|
committer | Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com> | 2018-07-11 13:20:28 -0400 |
commit | a96a3e49cd472aa902c22143358b87562603d47c (patch) | |
tree | 7e97578788de44f6704252cf982af09adcc05e8d /ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java | |
parent | 9ac542482e4710e5566d147ca7a7a42500628ba2 (diff) |
Adding User Auth and permission aaf services
Issue-ID: PORTAL-334
Change-Id: I2826f2a06f7d818d918ae5f45b500a8da78cec42
Signed-off-by: Kishore Reddy, Gujja (kg811t) <kg811t@research.att.com>
Diffstat (limited to 'ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java')
-rw-r--r-- | ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java index b35a1cda..4357b0a5 100644 --- a/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java +++ b/ecomp-sdk/epsdk-aaf/src/test/java/org/onap/portalsdk/external/authorization/util/EcompExternalAuthUtilsTest.java @@ -41,20 +41,21 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import javax.xml.bind.DatatypeConverter; + import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.portalsdk.core.onboarding.util.CipherUtil; -import org.onap.portalsdk.core.util.SystemProperties; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; import org.springframework.http.HttpHeaders; @RunWith(PowerMockRunner.class) -@PrepareForTest({ EcompExternalAuthProperties.class, CipherUtil.class }) +@PrepareForTest({ EcompExternalAuthProperties.class, CipherUtil.class, DatatypeConverter.class }) public class EcompExternalAuthUtilsTest { public static final String EXT_EMPTY_JSON_STRING = "{}"; @@ -73,6 +74,7 @@ public class EcompExternalAuthUtilsTest { public void setup() { PowerMockito.mockStatic(EcompExternalAuthProperties.class); PowerMockito.mockStatic(CipherUtil.class); + PowerMockito.mockStatic(DatatypeConverter.class); Mockito.when(EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_USER_NAME)) .thenReturn("test_username"); Mockito.when(EcompExternalAuthProperties.getProperty(EcompExternalAuthProperties.EXTERNAL_AUTH_PASSWORD)) @@ -82,19 +84,15 @@ public class EcompExternalAuthUtilsTest { @Test public void base64encodeKeyForAAFBasicAuthTest() throws Exception { - Mockito.when( - CipherUtil.decryptPKC("test_password", SystemProperties.getProperty(SystemProperties.Decryption_Key))) - .thenReturn("test_decrypted_password"); - HttpHeaders actual = EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth(); + HttpHeaders actual = EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth("test", "test"); assertNotNull(actual); } @Test(expected = NullPointerException.class) public void base64encodeKeyForAAFBasicAuthDecryptPassExceptionTest() throws Exception { - Mockito.when( - CipherUtil.decryptPKC("test_password", SystemProperties.getProperty(SystemProperties.Decryption_Key))) + Mockito.when(DatatypeConverter.printBase64Binary("test:test".getBytes())) .thenThrow(new NullPointerException()); - EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth(); + EcompExternalAuthUtils.base64encodeKeyForAAFBasicAuth("test", "test"); } @Test |