Skip to content

Commit

Permalink
Fix patchProjectParentTest
Browse files Browse the repository at this point in the history
A change in DataNucleus causes the `parent` field to no longer be unloaded.

Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Mar 1, 2024
1 parent c692eb8 commit 7c3714c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,8 @@ public void addTeamToRuleWithCustomEmailPublisherTest() {
"teams": [
{
"uuid": "${json-unit.matches:teamUuid}",
"name": "Team Example"
"name": "Team Example",
"permissions": []
}
],
"notifyOn": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.test.DeploymentContext;
import org.glassfish.jersey.test.ServletDeploymentContext;
import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -725,9 +726,24 @@ public void patchProjectParentTest() {

assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());

final JsonObject responseJson = parseJsonObject(response);
assertThat(responseJson.getString("uuid")).isEqualTo(project.getUuid().toString());
assertThat(responseJson.getJsonObject("parent")).isNull(); // Parents are currently not returned
assertThatJson(getPlainTextBody(response))
.withMatcher("projectUuid", CoreMatchers.equalTo(project.getUuid().toString()))
.withMatcher("parentProjectUuid", CoreMatchers.equalTo(newParent.getUuid().toString()))
.isEqualTo("""
{
"name": "DEF",
"version": "2.0",
"uuid": "${json-unit.matches:projectUuid}",
"parent": {
"name": "GHI",
"version": "3.0",
"uuid": "${json-unit.matches:parentProjectUuid}"
},
"properties": [],
"tags": [],
"active": true
}
""");

// Ensure the parent was updated.
qm.getPersistenceManager().refresh(project);
Expand Down

0 comments on commit 7c3714c

Please sign in to comment.