Skip to content

Commit

Permalink
fixed unit tests by adjusting expectations
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed May 9, 2022
1 parent e20c472 commit 64eba92
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -106,7 +106,7 @@ public void deletePolicy() {
public void postPolicy() {
getRoute(getPreAuthResult()).run(HttpRequest.POST("/policies")
.withEntity(APPLICATION_JSON, DUMMY_POLICY))
.assertStatusCode(StatusCodes.NOT_FOUND);
.assertStatusCode(StatusCodes.OK);
}

@Test
Expand Down
Expand Up @@ -65,6 +65,7 @@
import org.eclipse.ditto.policies.model.signals.commands.actions.TopLevelPolicyActionCommand;
import org.eclipse.ditto.policies.model.signals.commands.exceptions.PolicyActionFailedException;
import org.eclipse.ditto.policies.model.signals.commands.exceptions.PolicyNotAccessibleException;
import org.eclipse.ditto.policies.model.signals.commands.exceptions.PolicyNotCreatableException;
import org.eclipse.ditto.policies.model.signals.commands.exceptions.PolicyNotModifiableException;
import org.eclipse.ditto.policies.model.signals.commands.exceptions.PolicyPreconditionNotModifiedException;
import org.eclipse.ditto.policies.model.signals.commands.exceptions.PolicyUnavailableException;
Expand Down Expand Up @@ -203,7 +204,7 @@ public void createPolicyWhenPolicyAlreadyExistsAndAuthSubjectDoesNotHaveWritePer
assertThat((CharSequence) sudoRetrievePolicy.getEntityId()).isEqualTo(SUDO_RETRIEVE_POLICY.getEntityId());
policyPersistenceActorProbe.reply(createPolicyResponseWithoutWrite());

expectMsgClass(PolicyNotAccessibleException.class);
expectMsgClass(PolicyNotCreatableException.class);
}};
}

Expand Down Expand Up @@ -555,7 +556,7 @@ public void createPolicyWhenAuthSubjectHasWritePermission() {
assertThat((CharSequence) sudoRetrievePolicy.getEntityId()).isEqualTo(SUDO_RETRIEVE_POLICY.getEntityId());
policyPersistenceActorProbe.reply(createPolicyResponseWithoutWrite());

expectMsgClass(PolicyNotAccessibleException.class);
expectMsgClass(PolicyNotCreatableException.class);
}};
}

Expand Down Expand Up @@ -767,7 +768,7 @@ public void testCreatePolicy(final Iterable<String> grants, final boolean allowP
policyPersistenceActorProbe.reply(PolicyNotAccessibleException.newBuilder(POLICY_ID).build());

if (shouldFail) {
expectMsgClass(PolicyNotAccessibleException.class);
expectMsgClass(PolicyNotCreatableException.class);
} else {
policyPersistenceActorProbe.expectMsg(createPolicy);
final ActorRef commandSender = policyPersistenceActorProbe.lastSender();
Expand Down

0 comments on commit 64eba92

Please sign in to comment.