generated from pagopa/template-payments-java-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into P4ADEV-1633-classify-iuv-activity-retrieve-t…
…es-iuf
- Loading branch information
Showing
7 changed files
with
81 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import it.gov.pagopa.payhub.activities.service.OrganizationService; | ||
import it.gov.pagopa.payhub.activities.utility.faker.IngestionFlowFileFaker; | ||
import it.gov.pagopa.payhub.activities.utility.faker.OrganizationFaker; | ||
import it.gov.pagopa.payhub.activities.utility.faker.UserInfoFaker; | ||
import it.gov.pagopa.pu.p4paauth.dto.generated.UserInfo; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.Assertions; | ||
|
@@ -47,9 +48,7 @@ void givenNoOrganizationWhenConfigureThenOk() { | |
// Given | ||
EmailDTO emailDTO = new EmailDTO(); | ||
IngestionFlowFileDTO ingestionFlowFileDTO = IngestionFlowFileFaker.buildIngestionFlowFileDTO(); | ||
UserInfo userInfo = UserInfo.builder() | ||
.email("[email protected]") | ||
.build(); | ||
UserInfo userInfo = UserInfoFaker.buildUserInfo(); | ||
|
||
Mockito.when(authzServiceMock.getOperatorInfo(ingestionFlowFileDTO.getMappedExternalUserId())) | ||
.thenReturn(userInfo); | ||
|
@@ -71,9 +70,7 @@ void givenOrganizationWithSameEmailWhenConfigureThenOk() { | |
// Given | ||
EmailDTO emailDTO = new EmailDTO(); | ||
IngestionFlowFileDTO ingestionFlowFileDTO = IngestionFlowFileFaker.buildIngestionFlowFileDTO(); | ||
UserInfo userInfo = UserInfo.builder() | ||
.email("[email protected]") | ||
.build(); | ||
UserInfo userInfo = UserInfoFaker.buildUserInfo(); | ||
OrganizationDTO organizationDTO = OrganizationFaker.buildOrganizationDTO(); | ||
organizationDTO.setAdminEmail(userInfo.getEmail()); | ||
|
||
|
@@ -97,9 +94,7 @@ void givenOrganizationWithDifferentEmailWhenConfigureThenOk() { | |
// Given | ||
EmailDTO emailDTO = new EmailDTO(); | ||
IngestionFlowFileDTO ingestionFlowFileDTO = IngestionFlowFileFaker.buildIngestionFlowFileDTO(); | ||
UserInfo userInfo = UserInfo.builder() | ||
.email("[email protected]") | ||
.build(); | ||
UserInfo userInfo = UserInfoFaker.buildUserInfo(); | ||
OrganizationDTO organizationDTO = OrganizationFaker.buildOrganizationDTO(); | ||
|
||
Mockito.when(authzServiceMock.getOperatorInfo(ingestionFlowFileDTO.getMappedExternalUserId())) | ||
|
26 changes: 26 additions & 0 deletions
26
src/test/java/it/gov/pagopa/payhub/activities/utility/faker/UserInfoFaker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package it.gov.pagopa.payhub.activities.utility.faker; | ||
|
||
import it.gov.pagopa.pu.p4paauth.dto.generated.UserInfo; | ||
import it.gov.pagopa.pu.p4paauth.dto.generated.UserOrganizationRoles; | ||
|
||
import java.util.List; | ||
|
||
public class UserInfoFaker { | ||
|
||
public static UserInfo buildUserInfo() { | ||
return UserInfo.builder() | ||
.userId("USERID") | ||
.mappedExternalUserId("MAPPEDEXTERNALUSERID") | ||
.fiscalCode("FISCALCODE") | ||
.familyName("FAMILYNAME") | ||
.name("NAME") | ||
.email("[email protected]") | ||
.issuer("ISSUER") | ||
.organizations(List.of(UserOrganizationRoles.builder() | ||
.operatorId("OPERATORID") | ||
.organizationIpaCode("ORGIPACODE") | ||
.roles(List.of("ROLE_ADMIN")) | ||
.build())) | ||
.build(); | ||
} | ||
} |