shorter person names to make tests easier to read
This commit is contained in:
parent
956ee581c6
commit
16d1372d41
@ -59,10 +59,10 @@ end; $$;
|
||||
|
||||
do language plpgsql $$
|
||||
begin
|
||||
call createHsOfficePersonTestData('LEGAL', 'First Impressions GmbH');
|
||||
call createHsOfficePersonTestData('LEGAL', 'First GmbH');
|
||||
call createHsOfficePersonTestData('NATURAL', null, 'Smith', 'Peter');
|
||||
call createHsOfficePersonTestData('LEGAL', 'Rockshop e.K.', 'Sandra', 'Miller');
|
||||
call createHsOfficePersonTestData('SOLE_REPRESENTATION', 'Ostfriesische Kuhhandel OHG');
|
||||
call createHsOfficePersonTestData('LEGAL', 'Second e.K.', 'Sandra', 'Miller');
|
||||
call createHsOfficePersonTestData('SOLE_REPRESENTATION', 'Third OHG');
|
||||
call createHsOfficePersonTestData('JOINT_REPRESENTATION', 'Erben Bessler', 'Mel', 'Bessler');
|
||||
call createHsOfficePersonTestData('NATURAL', null, 'Bessler', 'Anita');
|
||||
call createHsOfficePersonTestData('NATURAL', null, 'Winkler', 'Paul');
|
||||
|
@ -63,11 +63,11 @@ end; $$;
|
||||
|
||||
do language plpgsql $$
|
||||
begin
|
||||
call createHsOfficePartnerTestData('First Impressions GmbH', 'first contact');
|
||||
call createHsOfficePartnerTestData('First GmbH', 'first contact');
|
||||
|
||||
call createHsOfficePartnerTestData('Rockshop e.K.', 'second contact');
|
||||
call createHsOfficePartnerTestData('Second e.K.', 'second contact');
|
||||
|
||||
call createHsOfficePartnerTestData('Ostfriesische Kuhhandel OHG', 'third contact');
|
||||
call createHsOfficePartnerTestData('Third OHG', 'third contact');
|
||||
end;
|
||||
$$;
|
||||
--//
|
||||
|
@ -71,11 +71,11 @@ end; $$;
|
||||
|
||||
do language plpgsql $$
|
||||
begin
|
||||
call createHsOfficeRelationshipTestData('First Impressions GmbH', 'Smith', 'SOLE_AGENT', 'first contact');
|
||||
call createHsOfficeRelationshipTestData('First GmbH', 'Smith', 'SOLE_AGENT', 'first contact');
|
||||
|
||||
call createHsOfficeRelationshipTestData('Rockshop e.K.', 'Smith', 'SOLE_AGENT', 'second contact');
|
||||
call createHsOfficeRelationshipTestData('Second e.K.', 'Smith', 'SOLE_AGENT', 'second contact');
|
||||
|
||||
call createHsOfficeRelationshipTestData('Ostfriesische Kuhhandel OHG', 'Smith', 'SOLE_AGENT', 'third contact');
|
||||
call createHsOfficeRelationshipTestData('Third OHG', 'Smith', 'SOLE_AGENT', 'third contact');
|
||||
end;
|
||||
$$;
|
||||
--//
|
||||
|
@ -77,15 +77,15 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.body("", lenientlyEquals("""
|
||||
[
|
||||
{
|
||||
"person": { "tradeName": "First Impressions GmbH" },
|
||||
"person": { "tradeName": "First GmbH" },
|
||||
"contact": { "label": "first contact" }
|
||||
},
|
||||
{
|
||||
"person": { "tradeName": "Ostfriesische Kuhhandel OHG" },
|
||||
"person": { "tradeName": "Third OHG" },
|
||||
"contact": { "label": "third contact" }
|
||||
},
|
||||
{
|
||||
"person": { "tradeName": "Rockshop e.K." },
|
||||
"person": { "tradeName": "Second e.K." },
|
||||
"contact": { "label": "second contact" }
|
||||
}
|
||||
]
|
||||
@ -102,7 +102,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
void globalAdmin_withoutAssumedRole_canAddPartner() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
@ -140,7 +140,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
void globalAdmin_canNotAddPartner_ifContactDoesNotExist() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenContactUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
@ -214,7 +214,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"person": { "tradeName": "First Impressions GmbH" },
|
||||
"person": { "tradeName": "First GmbH" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
""")); // @formatter:on
|
||||
@ -253,7 +253,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"person": { "tradeName": "First Impressions GmbH" },
|
||||
"person": { "tradeName": "First GmbH" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
""")); // @formatter:on
|
||||
@ -269,7 +269,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenPartner = givenSomeTemporaryPartnerBessler();
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
|
||||
final var location = RestAssured // @formatter:off
|
||||
@ -303,7 +303,7 @@ class HsOfficePartnerControllerAcceptanceTest {
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
assertThat(partnerRepo.findByUuid(givenPartner.getUuid())).isPresent().get()
|
||||
.matches(person -> {
|
||||
assertThat(person.getPerson().getTradeName()).isEqualTo("Ostfriesische Kuhhandel OHG");
|
||||
assertThat(person.getPerson().getTradeName()).isEqualTo("Third OHG");
|
||||
assertThat(person.getContact().getLabel()).isEqualTo("forth contact");
|
||||
assertThat(person.getRegistrationOffice()).isEqualTo("Registergericht Hamburg");
|
||||
assertThat(person.getRegistrationNumber()).isEqualTo("222222");
|
||||
|
@ -71,7 +71,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// given
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var count = partnerRepo.count();
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("First Impressions GmbH").get(0);
|
||||
final var givenPerson = personRepo.findPersonByOptionalNameLike("First GmbH").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("first contact").get(0);
|
||||
|
||||
// when
|
||||
@ -150,21 +150,21 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// then
|
||||
allThesePartnersAreReturned(
|
||||
result,
|
||||
"partner(Ostfriesische Kuhhandel OHG, third contact)",
|
||||
"partner(Rockshop e.K., second contact)",
|
||||
"partner(First Impressions GmbH, first contact)");
|
||||
"partner(Third OHG, third contact)",
|
||||
"partner(Second e.K., second contact)",
|
||||
"partner(First GmbH, first contact)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void normalUser_canViewOnlyRelatedPartners() {
|
||||
// given:
|
||||
context("person-FirstImpressionsGmbH@example.com");
|
||||
context("person-FirstGmbH@example.com");
|
||||
|
||||
// when:
|
||||
final var result = partnerRepo.findPartnerByOptionalNameLike(null);
|
||||
|
||||
// then:
|
||||
exactlyThesePartnersAreReturned(result, "partner(First Impressions GmbH, first contact)");
|
||||
exactlyThesePartnersAreReturned(result, "partner(First GmbH, first contact)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -180,7 +180,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
final var result = partnerRepo.findPartnerByOptionalNameLike("third contact");
|
||||
|
||||
// then
|
||||
exactlyThesePartnersAreReturned(result, "partner(Ostfriesische Kuhhandel OHG, third contact)");
|
||||
exactlyThesePartnersAreReturned(result, "partner(Third OHG, third contact)");
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
"hs_office_person#ErbenBesslerMelBessler.admin");
|
||||
assertThatPartnerActuallyInDatabase(givenPartner);
|
||||
context("superuser-alex@hostsharing.net");
|
||||
final var givenNewPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische Kuhhandel OHG").get(0);
|
||||
final var givenNewPerson = personRepo.findPersonByOptionalNameLike("Third OHG").get(0);
|
||||
final var givenNewContact = contactRepo.findContactByOptionalLabelLike("sixth contact").get(0);
|
||||
|
||||
// when
|
||||
@ -216,7 +216,7 @@ class HsOfficePartnerRepositoryIntegrationTest extends ContextBasedTest {
|
||||
"global#global.admin");
|
||||
assertThatPartnerIsVisibleForUserWithRole(
|
||||
result.returnedValue(),
|
||||
"hs_office_person#OstfriesischeKuhhandelOHG.admin");
|
||||
"hs_office_person#ThirdOHG.admin");
|
||||
assertThatPartnerIsNotVisibleForUserWithRole(
|
||||
result.returnedValue(),
|
||||
"hs_office_person#ErbenBesslerMelBessler.admin");
|
||||
|
@ -83,19 +83,19 @@ class HsOfficePersonControllerAcceptanceTest {
|
||||
},
|
||||
{
|
||||
"personType": "LEGAL",
|
||||
"tradeName": "First Impressions GmbH",
|
||||
"tradeName": "First GmbH",
|
||||
"givenName": null,
|
||||
"familyName": null
|
||||
},
|
||||
{
|
||||
"personType": "SOLE_REPRESENTATION",
|
||||
"tradeName": "Ostfriesische Kuhhandel OHG",
|
||||
"tradeName": "Third OHG",
|
||||
"givenName": null,
|
||||
"familyName": null
|
||||
},
|
||||
{
|
||||
"personType": "LEGAL",
|
||||
"tradeName": "Rockshop e.K.",
|
||||
"tradeName": "Second e.K.",
|
||||
"givenName": "Miller",
|
||||
"familyName": "Sandra"
|
||||
},
|
||||
|
@ -144,8 +144,8 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
|
||||
allThesePersonsAreReturned(
|
||||
result,
|
||||
"Smith, Peter",
|
||||
"Rockshop e.K.",
|
||||
"Ostfriesische Kuhhandel OHG",
|
||||
"Second e.K.",
|
||||
"Third OHG",
|
||||
"Erben Bessler");
|
||||
}
|
||||
|
||||
@ -172,10 +172,10 @@ class HsOfficePersonRepositoryIntegrationTest extends ContextBasedTest {
|
||||
context("superuser-alex@hostsharing.net", null);
|
||||
|
||||
// when
|
||||
final var result = personRepo.findPersonByOptionalNameLike("Rockshop");
|
||||
final var result = personRepo.findPersonByOptionalNameLike("Second");
|
||||
|
||||
// then
|
||||
exactlyThesePersonsAreReturned(result, "Rockshop e.K.");
|
||||
exactlyThesePersonsAreReturned(result, "Second e.K.");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -85,7 +85,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
{
|
||||
"relAnchor": {
|
||||
"personType": "SOLE_REPRESENTATION",
|
||||
"tradeName": "Ostfriesische Kuhhandel OHG"
|
||||
"tradeName": "Third OHG"
|
||||
},
|
||||
"relHolder": {
|
||||
"personType": "NATURAL",
|
||||
@ -98,7 +98,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
{
|
||||
"relAnchor": {
|
||||
"personType": "LEGAL",
|
||||
"tradeName": "Rockshop e.K.",
|
||||
"tradeName": "Second e.K.",
|
||||
"givenName": "Miller",
|
||||
"familyName": "Sandra"
|
||||
},
|
||||
@ -113,7 +113,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
{
|
||||
"relAnchor": {
|
||||
"personType": "LEGAL",
|
||||
"tradeName": "First Impressions GmbH"
|
||||
"tradeName": "First GmbH"
|
||||
},
|
||||
"relHolder": {
|
||||
"personType": "NATURAL",
|
||||
@ -138,7 +138,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
void globalAdmin_withoutAssumedRole_canAddRelationship() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0);
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0);
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
|
||||
@ -166,7 +166,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.contentType(ContentType.JSON)
|
||||
.body("uuid", isUuidValid())
|
||||
.body("relType", is("ACCOUNTING_CONTACT"))
|
||||
.body("relAnchor.tradeName", is("Ostfriesische Kuhhandel OHG"))
|
||||
.body("relAnchor.tradeName", is("Third OHG"))
|
||||
.body("relHolder.givenName", is("Paul"))
|
||||
.body("contact.label", is("forth contact"))
|
||||
.header("Location", startsWith("http://localhost"))
|
||||
@ -215,7 +215,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
void globalAdmin_canNotAddRelationship_ifHolderPersonDoesNotExist() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0);
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenHolderPersonUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
|
||||
final var givenContact = contactRepo.findContactByOptionalLabelLike("forth").get(0);
|
||||
|
||||
@ -248,7 +248,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
void globalAdmin_canNotAddRelationship_ifContactDoesNotExist() {
|
||||
|
||||
context.define("superuser-alex@hostsharing.net");
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Ostfriesische").get(0);
|
||||
final var givenAnchorPerson = personRepo.findPersonByOptionalNameLike("Third").get(0);
|
||||
final var givenHolderPerson = personRepo.findPersonByOptionalNameLike("Paul").get(0);
|
||||
final var givenContactUuid = UUID.fromString("3fa85f64-5717-4562-b3fc-2c963f66afa6");
|
||||
|
||||
@ -298,7 +298,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"relAnchor": { "tradeName": "First Impressions GmbH" },
|
||||
"relAnchor": { "tradeName": "First GmbH" },
|
||||
"relHolder": { "familyName": "Smith" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
@ -339,7 +339,7 @@ class HsOfficeRelationshipControllerAcceptanceTest {
|
||||
.contentType("application/json")
|
||||
.body("", lenientlyEquals("""
|
||||
{
|
||||
"relAnchor": { "tradeName": "First Impressions GmbH" },
|
||||
"relAnchor": { "tradeName": "First GmbH" },
|
||||
"relHolder": { "familyName": "Smith" },
|
||||
"contact": { "label": "first contact" }
|
||||
}
|
||||
|
@ -162,15 +162,15 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// then
|
||||
allTheseRelationshipsAreReturned(
|
||||
result,
|
||||
"rel(relAnchor='First Impressions GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')",
|
||||
"rel(relAnchor='Ostfriesische Kuhhandel OHG', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='third contact')",
|
||||
"rel(relAnchor='Rockshop e.K.', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='second contact')");
|
||||
"rel(relAnchor='First GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')",
|
||||
"rel(relAnchor='Third OHG', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='third contact')",
|
||||
"rel(relAnchor='Second e.K.', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='second contact')");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void normalUser_canViewRelationshipsOfOwnedPersons() {
|
||||
// given:
|
||||
context("person-FirstImpressionsGmbH@example.com");
|
||||
context("person-FirstGmbH@example.com");
|
||||
final var person = personRepo.findPersonByOptionalNameLike("First").stream().findFirst().orElseThrow();
|
||||
|
||||
// when:
|
||||
@ -179,7 +179,7 @@ class HsOfficeRelationshipRepositoryIntegrationTest extends ContextBasedTest {
|
||||
// then:
|
||||
exactlyTheseRelationshipsAreReturned(
|
||||
result,
|
||||
"rel(relAnchor='First Impressions GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')");
|
||||
"rel(relAnchor='First GmbH', relType='SOLE_AGENT', relHolder='Smith, Peter', contact='first contact')");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user