From a9009a6f89c41dc19b85331dda676993c8a273b9 Mon Sep 17 00:00:00 2001 From: lalber Date: Wed, 4 Nov 2020 16:42:46 +0100 Subject: fix pw aliasname --- .../tasks/CreateIdentityLinkTaskEidNewTest.java | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) (limited to 'eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus') diff --git a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java index 031ea825..00e01a2c 100644 --- a/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java +++ b/eidas_modules/authmodule-eIDAS-v2/src/test/java/at/asitplus/eidas/specific/modules/auth/eidas/v2/test/tasks/CreateIdentityLinkTaskEidNewTest.java @@ -1,5 +1,8 @@ package at.asitplus.eidas.specific.modules.auth.eidas.v2.test.tasks; +import static at.asitplus.eidas.specific.connector.MsEidasNodeConstants.PROP_CONFIG_SP_AUTHBLOCK_FRIENDLYNAME; +import static at.asitplus.eidas.specific.connector.MsEidasNodeConstants.PROP_CONFIG_SP_AUTHBLOCK_PW; +import static at.asitplus.eidas.specific.connector.MsEidasNodeConstants.PROP_CONFIG_SP_EID_MODE; import static org.mockito.ArgumentMatchers.any; import static org.powermock.api.mockito.PowerMockito.when; @@ -81,6 +84,9 @@ public class CreateIdentityLinkTaskEidNewTest { private TestRequestImpl pendingReq; private DummySpConfiguration oaParam; private SZR szrMock; + + private static final String PW = "f/+saJBc3a}*/T^s"; + private static final String ALIAS = "connectorkeypair"; @Rule public final SoapServiceRule soap = SoapServiceRule.newInstance(); @@ -112,13 +118,17 @@ public class CreateIdentityLinkTaskEidNewTest { final Map spConfig = new HashMap<>(); spConfig.put(EaafConfigConstants.SERVICE_UNIQUEIDENTIFIER, "testSp"); spConfig.put("target", "urn:publicid:gv.at:cdid+XX"); - spConfig.put("eidMode", "new"); + spConfig.put(PROP_CONFIG_SP_EID_MODE, "new"); + spConfig.put(PROP_CONFIG_SP_AUTHBLOCK_PW, PW); + spConfig.put(PROP_CONFIG_SP_AUTHBLOCK_FRIENDLYNAME, ALIAS); oaParam = new DummySpConfiguration(spConfig, basicConfig); pendingReq = new TestRequestImpl(); AuthenticationResponse response = buildDummyAuthResponse(); + + pendingReq.getSessionData(AuthProcessDataWrapper.class).setGenericDataToSession(Constants.DATA_FULL_EIDAS_RESPONSE, response); pendingReq.setSpConfig(oaParam); pendingReq.setPendingReqId(at.gv.egiz.eaaf.core.impl.utils.Random.nextProcessReferenceValue()); @@ -169,40 +179,20 @@ public class CreateIdentityLinkTaskEidNewTest { String test = szrMock.getStammzahlEncrypted(new PersonInfoType(), false); -// SZR szrMock2 = Mockito.mock(SZR.class, Mockito.CALLS_REAL_METHODS); when(szrMock, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); val signContentResp = new SignContentResponseType(); SignContentEntry signContentEntry = new SignContentEntry(); signContentEntry.setValue(RandomStringUtils.randomAlphanumeric(10)); signContentResp.getOut().add(signContentEntry); when(szrMock, "signContent", any(), any(), any()).thenReturn(signContentResp); -// when(szrMock2, "getStammzahlEncrypted", any(), any()).thenReturn(RandomStringUtils.randomNumeric(10)); - // Wie kann ich das vom Bean rein gehängte SZR mit dem Mock überschreiben? - task.execute(pendingReq, executionContext); -// authTask.execute(pendingReq, executionContext); } catch (Exception e) { e.printStackTrace(); Assert.fail(); } -// val spyTask = spy(task); -// Map requiredAttributes = new HashMap<>(); -// requiredAttributes.put(Constants.eIDAS_ATTR_PERSONALIDENTIFIER, "asdf"); -// requiredAttributes.put(Constants.eIDAS_ATTR_CURRENTFAMILYNAME, "asdf"); -// requiredAttributes.put(Constants.eIDAS_ATTR_CURRENTGIVENNAME, "asdf"); -// requiredAttributes.put(Constants.eIDAS_ATTR_DATEOFBIRTH, new DateTime()); -// requiredAttributes.put(Constants.eIDAS_ATTR_PLACEOFBIRTH, "adf"); -// requiredAttributes.put(Constants.eIDAS_ATTR_BIRTHNAME, "adf"); -// requiredAttributes.put(Constants.eIDAS_ATTR_CURRENTADDRESS, new PostalAddressType()); -// try { -// doReturn(requiredAttributes).when(spyTask, "convertEidasAttrToSimpleMap", (any(ImmutableMap.class))); -// spyTask.execute(pendingReq, executionContext); -// } catch (final Exception e) { -// e.printStackTrace(); -// Assert.fail(); -// } + } } -- cgit v1.2.3