From c335b88a3fcaaee2c764f497c248391e0647757a Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Thu, 28 Sep 2023 11:39:30 +0200 Subject: [PATCH] Fetch IdP from Manage for institution admins --- server/src/test/java/access/AbstractTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/src/test/java/access/AbstractTest.java b/server/src/test/java/access/AbstractTest.java index f369ae52..fe7a2a78 100644 --- a/server/src/test/java/access/AbstractTest.java +++ b/server/src/test/java/access/AbstractTest.java @@ -317,19 +317,21 @@ protected void stubForManageProvisioning(List identifiers) throws JsonPr protected void stubForManageProviderByOrganisationGUID(String organisationGUID) throws JsonProcessingException { String path = "/manage/api/internal/search/%s"; List> providers = localManage.providersByInstitutionalGUID(organisationGUID); - Map>> providersMap = Map.of( + Optional> identityProvider = localManage.identityProviderByInstitutionalGUID(organisationGUID); + Map providersMap = Map.of( EntityType.SAML20_SP, providers.stream().filter(m -> m.get("type").equals(EntityType.SAML20_SP.collectionName())).toList(), + EntityType.SAML20_IDP, + List.of(identityProvider.get()), EntityType.OIDC10_RP, providers.stream().filter(m -> m.get("type").equals(EntityType.OIDC10_RP.collectionName())).toList() ); //Lambda can't do exception handling - for (Map.Entry>> entry : providersMap.entrySet()) { + for (Map.Entry entry : providersMap.entrySet()) { EntityType entityType = entry.getKey(); - List> providerList = entry.getValue(); stubFor(post(urlPathMatching(String.format(path, entityType.collectionName()))).willReturn(aResponse() .withHeader("Content-Type", "application/json") - .withBody(objectMapper.writeValueAsString(providerList)))); + .withBody(objectMapper.writeValueAsString(entry.getValue())))); } }