Skip to content

Commit

Permalink
XRDDEV-1792 add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iluwatar committed Oct 21, 2021
1 parent 4e1c826 commit 47db74a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,22 @@ public void testGetHighAvailabilityStatusRestEndpoint() {
assertEquals(false, response.getBody().getIsHaConfigured());
assertEquals("node_0", response.getBody().getNodeName());
}

@Test
@WithMockUser(authorities = {"INSTANCE_IDENTIFIER"})
public void testGetInstanceIdentifier() {
ResponseEntity<String> response =
restTemplate.getForEntity("/api/v1/system/instance-identifier", String.class);
assertNotNull(response, "Instance identifier response must not be null.");
assertEquals(200, response.getStatusCodeValue(), "Instance identifier response status code must be 200 ");
}

@Test
@WithMockUser(authorities = {"CENTRAL_SERVER_ADDRESS"})
public void testGetCentralServerAddress() {
ResponseEntity<String> response =
restTemplate.getForEntity("/api/v1/system/central-server-address", String.class);
assertNotNull(response, "Central server address response must not be null.");
assertEquals(200, response.getStatusCodeValue(), "Central server address response status code must be 200 ");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public void testViewVersionEndpoint() {
assertEquals(200, response.getStatusCodeValue(), "Version response status code must be 200 ");
assertNotNull(response.getBody());
assertEquals(ee.ria.xroad.common.Version.XROAD_VERSION, response.getBody().getInfo());

}

@Test
Expand All @@ -67,4 +66,21 @@ public void testGetHighAvailabilityStatusEndpoint() {
assertEquals(false, response.getBody().getIsHaConfigured());
assertEquals("node_0", response.getBody().getNodeName());
}

@Test
@WithMockUser(authorities = {"INSTANCE_IDENTIFIER"})
public void testGetInstanceIdentifierEndpoint() {
ResponseEntity<String> response = systemApiController.instanceidentifier();
assertNotNull(response, "Instance identifier response must not be null.");
assertEquals(200, response.getStatusCodeValue(), "Instance identifier response status code must be 200 ");
}

@Test
@WithMockUser(authorities = {"CENTRAL_SERVER_ADDRESS"})
public void testGetCentralServerAddressEndpoint() {
ResponseEntity<String> response = systemApiController.centralServerAddress();
assertNotNull(response, "Central server address response must not be null.");
assertEquals(200, response.getStatusCodeValue(), "Central server address response status code must be 200 ");
}

}

0 comments on commit 47db74a

Please sign in to comment.