Skip to content

Commit

Permalink
Adapt test to new behavior: Update -> AliasFeatureDisabled -> Existin…
Browse files Browse the repository at this point in the history
…gAlias -> shouldAccept_ShouldIgnoreDanglingReference (renamed to "shouldReject_EvenIfAliasReferenceIsBroken")
  • Loading branch information
adrianhoelzl-sap committed Mar 28, 2024
1 parent 07366c2 commit 2b116b9
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -921,16 +921,16 @@ private void shouldAccept_ShouldIgnoreAliasIdOfExistingIdpMissing(
}

@Test
void shouldAccept_ShouldIgnoreDanglingReference_UaaToCustomZone() throws Throwable {
shouldAccept_ShouldIgnoreDanglingReference(IdentityZone.getUaa(), customZone);
void shouldReject_EvenIfAliasReferenceIsBroken_UaaToCustomZone() throws Throwable {
shouldReject_EvenIfAliasReferenceIsBroken(IdentityZone.getUaa(), customZone);
}

@Test
void shouldAccept_ShouldIgnoreDanglingReference_CustomToUaaZone() throws Throwable {
shouldAccept_ShouldIgnoreDanglingReference(customZone, IdentityZone.getUaa());
void shouldReject_EvenIfAliasReferenceIsBroken_CustomToUaaZone() throws Throwable {
shouldReject_EvenIfAliasReferenceIsBroken(customZone, IdentityZone.getUaa());
}

private void shouldAccept_ShouldIgnoreDanglingReference(
private void shouldReject_EvenIfAliasReferenceIsBroken(
final IdentityZone zone1,
final IdentityZone zone2
) throws Throwable {
Expand All @@ -942,14 +942,9 @@ private void shouldAccept_ShouldIgnoreDanglingReference(
// create dangling reference by removing alias IdP directly in DB
deleteIdpViaDb(existingIdp.getOriginKey(), zone2.getId());

// update original IdP
existingIdp.setAliasId(null);
existingIdp.setAliasZid(null);
// try to update IdP -> should still fail, even if the alias reference is broken
existingIdp.setName("some-new-name");
final IdentityProvider<?> updatedIdp = updateIdp(zone1, existingIdp);
assertThat(updatedIdp.getName()).isEqualTo("some-new-name");
assertThat(updatedIdp.getAliasId()).isBlank();
assertThat(updatedIdp.getAliasZid()).isBlank();
shouldRejectUpdate(zone1, existingIdp, HttpStatus.UNPROCESSABLE_ENTITY);
}

@Test
Expand Down

0 comments on commit 2b116b9

Please sign in to comment.