Skip to content

Commit

Permalink
Adding the new encryption endpoints to the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cody-constine-ttd committed Dec 13, 2024
1 parent aca4204 commit cd3e09e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/test/java/suite/core/CoreRefreshTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,26 @@ public void testCollectionRefresh_Public_Success(Core core, String urlPath, Stri
}
}

@ParameterizedTest(name = "Refresh test - UrlPath: {1} - CollectionName: {2}")
@MethodSource({"suite.core.TestData#collectionEndpointArgs"})
public void testCollectionRefreshCloud_Encryption_Public_Success(Core core, String urlPath, String collectionName) throws Exception {
JsonNode response = core.getWithCoreApiToken(urlPath, "10000.0.1");

assertAll("testCollectionRefresh_Public_Success has version and collection",
() -> assertNotNull(response, "Response should not be null"),
() -> assertNotEquals("", response.at("/version").asText(), "Version was empty"),
() -> assertNotNull(response.at("/" + collectionName), "Collection should not be null")
);

ArrayNode nodes = (ArrayNode) response.at("/" + collectionName);
for (JsonNode node : nodes) {
assertTrue(JsonAssert.hasContentInFields(
node, List.of("/effective", "/expires", "/location", "/size")
), "Collection node was missing expected content");
assertTrue(node.get("location").asText().contains("encrypted"));
}
}

@ParameterizedTest(name = "Refresh test - UrlPath: {1} - JsonPath: {2}")
@MethodSource({"suite.core.TestData#optOutRefreshArgs"})
public void testOptOut_LocationRefresh_Public_Success(Core core, String urlPath, String jsonPath) throws Exception {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/suite/core/TestData.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public static Set<Arguments> refreshArgs() {
for (Core core : cores) {
args.add(Arguments.of(core, "/key/acl/refresh", "keys_acl"));
args.add(Arguments.of(core, "/key/refresh", "keys"));
args.add(Arguments.of(core, "/client_side_keypairs/refresh", "client_side_keypairs"));
}

return args;
Expand All @@ -41,6 +40,7 @@ public static Set<Arguments> refreshArgsEncrypted() {
args.add(Arguments.of(core, "/key/keyset-keys/refresh", "keyset_keys"));
args.add(Arguments.of(core, "/clients/refresh", "client_keys"));
args.add(Arguments.of(core, "/sites/refresh", "sites"));
args.add(Arguments.of(core, "/client_side_keypairs/refresh", "client_side_keypairs"));
}

return args;
Expand Down

0 comments on commit cd3e09e

Please sign in to comment.