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