diff --git a/src/test/java/DirectoryClientTest.java b/src/test/java/DirectoryClientTest.java index e2c4f85..cd2364b 100644 --- a/src/test/java/DirectoryClientTest.java +++ b/src/test/java/DirectoryClientTest.java @@ -143,20 +143,20 @@ void testGetRelations() { assertEquals(10, getRelationsResponse.getResultsList().size()); } -// @Test -// @Tag("IntegrationTest") -// void testCheckRelationAdmin() { -// // Arrange & Act -// CheckRelationResponse checkRelationResponse = directoryClient.checkRelation( -// "group", -// "admin", -// "member", -// "user", -// "rick@the-citadel.com"); -// -// // Assert -// assertTrue(checkRelationResponse.getCheck()); -// } + @Test + @Tag("IntegrationTest") + void testCheckRelationAdmin() { + // Arrange & Act + CheckRelationResponse checkRelationResponse = directoryClient.checkRelation( + "group", + "admin", + "member", + "user", + "rick@the-citadel.com"); + + // Assert + assertTrue(checkRelationResponse.getCheck()); + } @Test @Tag("IntegrationTest") @@ -173,20 +173,20 @@ void testCheckRelationViewer() { assertFalse(checkRelationResponse.getCheck()); } -// @Test -// @Tag("IntegrationTest") -// void testCheckAdmin() { -// // Arrange & Act -// CheckResponse checkResponse = directoryClient.check( -// "group", -// "admin", -// "member", -// "user", -// "rick@the-citadel.com"); -// -// // Assert -// assertTrue(checkResponse.getCheck()); -// } + @Test + @Tag("IntegrationTest") + void testCheckAdmin() { + // Arrange & Act + CheckResponse checkResponse = directoryClient.check( + "group", + "admin", + "member", + "user", + "rick@the-citadel.com"); + + // Assert + assertTrue(checkResponse.getCheck()); + } @Test @Tag("IntegrationTest") diff --git a/src/test/java/utils/Topaz.java b/src/test/java/utils/Topaz.java index dd9d1ba..241cada 100644 --- a/src/test/java/utils/Topaz.java +++ b/src/test/java/utils/Topaz.java @@ -38,6 +38,7 @@ public void run() throws IOException, InterruptedException, URISyntaxException { backupCfg(); configure(); start(); + setManifest(); loadData(); } @@ -46,8 +47,17 @@ public void stop() throws IOException, InterruptedException { process.waitFor(); restoreDb(); restoreCfg(); + // delete temp directory used to store downloaded files deleteDirectory(new File("temp")); } + public void setManifest() throws IOException, URISyntaxException, InterruptedException { + downloadFile("https://raw.githubusercontent.com/aserto-dev/topaz/main/assets/citadel/manifest.yaml", "temp/manifest.yaml"); + + ProcessBuilder pb = new ProcessBuilder("topaz","manifest", "set", "-i", "temp/manifest.yaml"); + pb.inheritIO(); + Process process = pb.start(); + process.waitFor(); + } private void loadData() throws IOException, URISyntaxException, InterruptedException { downloadFile("https://raw.githubusercontent.com/aserto-dev/topaz/main/assets/citadel/citadel_objects.json", "temp/citadel_objects.json"); @@ -59,15 +69,6 @@ private void loadData() throws IOException, URISyntaxException, InterruptedExcep process.waitFor(); } - private void removeTempFile(String... files) { - for (String file: files) { - File tempFile = new File(file); - if(tempFile.exists()) { - tempFile.delete(); - } - } - } - private void deleteDirectory(File directoryToBeDeleted) { File[] allContents = directoryToBeDeleted.listFiles(); if (allContents != null) {