introduce-partner-business-role #16
@ -287,11 +287,11 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
@Test
|
||||
public void hostsharingAdmin_withoutAssumedRole_canUpdateArbitraryPartner() {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(20032, "Erben Bessler", "fifth contact");
|
||||
context("superuser-alex@hostsharing.net", "hs_office_partner#20033:ErbenBesslerMelBessler.admin");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(20036, "Erben Bessler", "fifth contact");
|
||||
assertThatPartnerIsVisibleForUserWithRole(
|
||||
givenPartner,
|
||||
"hs_office_partner#20032:ErbenBesslerMelBessler-fifthcontact.admin");
|
||||
"hs_office_partner#20033:ErbenBesslerMelBessler-fifthcontact.admin");
|
||||
assertThatPartnerActuallyInDatabase(givenPartner);
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenNewPerson = personRepo.findPersonByOptionalNameLike("Third OHG").get(0);
|
||||
@ -324,20 +324,20 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
public void partnerAgent_canNotUpdateRelatedPartner() {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(20032, "Erben Bessler", "ninth");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(20037, "Erben Bessler", "ninth");
|
||||
final var newPartnerRole = em.createNativeQuery(
|
||||
"select uuid from hs_office_relationship where uuid=:partnerRoleUuid")
|
||||
.setParameter("partnerRoleUuid", givenPartner.getPartnerRole().getUuid())
|
||||
.getSingleResult();
|
||||
assertThatPartnerIsVisibleForUserWithRole(
|
||||
givenPartner,
|
||||
"hs_office_partner#20032:ErbenBesslerMelBessler-ninthcontact.agent");
|
||||
"hs_office_partner#20033:ErbenBesslerMelBessler-ninthcontact.agent");
|
||||
assertThatPartnerActuallyInDatabase(givenPartner);
|
||||
|
||||
// when
|
||||
final var result = jpaAttempt.transacted(() -> {
|
||||
context("superuser-alex@hostsharing.net",
|
||||
"hs_office_partner#20032:ErbenBesslerMelBessler-ninthcontact.agent");
|
||||
"hs_office_partner#20033:ErbenBesslerMelBessler-ninthcontact.agent");
|
||||
givenPartner.getDetails().setBirthName("new birthname");
|
||||
return partnerRepo.save(givenPartner);
|
||||
});
|
||||
@ -425,7 +425,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var initialRoleNames = Array.from(roleNamesOf(rawRoleRepo.findAll()));
|
||||
final var initialGrantNames = Array.from(grantDisplaysOf(rawGrantRepo.findAll()));
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(20032, "Erben Bessler", "twelfth");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler(20034, "Erben Bessler", "twelfth");
|
||||
|
||||
// when
|
||||
final var result = jpaAttempt.transacted(() -> {
|
||||
@ -506,7 +506,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTestWithClean
|
||||
@AfterEach
|
||||
void cleanup() {
|
||||
cleanupAllNew(HsOfficePartnerEntity.class);
|
||||
cleanupAllNew(HsOfficePartnerDetailsEntity.class);
|
||||
cleanupAllNew(HsOfficePartnerDetailsEntity.class); // TODO: should not be necessary
|
||||
cleanupAllNew(HsOfficeRelationshipEntity.class);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user