mirror of
https://github.com/nsacyber/HIRS.git
synced 2024-12-18 20:47:58 +00:00
fixed error in DeviceInfoReportTest
This commit is contained in:
parent
3e4fe50dc7
commit
3fbc6bd301
@ -7,6 +7,7 @@ import hirs.attestationca.persist.entity.userdefined.info.NetworkInfo;
|
||||
import hirs.attestationca.persist.entity.userdefined.info.HardwareInfo;
|
||||
import hirs.attestationca.persist.entity.userdefined.info.FirmwareInfo;
|
||||
|
||||
import hirs.utils.VersionHelper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
@ -21,7 +22,7 @@ public class DeviceInfoReportTest extends AbstractUserdefinedEntityTest {
|
||||
private final HardwareInfo hardwareInfo = createTestHardwareInfo();
|
||||
private final TPMInfo tpmInfo = createTPMInfo();
|
||||
|
||||
private static final String EXPECTED_CLIENT_VERSION = "Test.Version";
|
||||
private static final String EXPECTED_CLIENT_VERSION = VersionHelper.getVersion();
|
||||
|
||||
/**
|
||||
* Tests instantiation of a DeviceInfoReport.
|
||||
|
@ -1 +0,0 @@
|
||||
Test.Version
|
@ -26,7 +26,7 @@ server.tomcat.accesslog.suffix=.log
|
||||
server.tomcat.accesslog.rotate=true
|
||||
|
||||
# Tomcat TLS support
|
||||
server.port=8443
|
||||
server.port=8449
|
||||
server.ssl.enabled=true
|
||||
server.ssl.trust-store-type=JKS
|
||||
server.ssl.trust-store=/etc/hirs/certificates/HIRS/TrustStore.jks
|
||||
|
@ -12,6 +12,7 @@ import hirs.attestationca.portal.page.PageControllerTest;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -20,12 +21,9 @@ import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
import static hirs.attestationca.portal.page.Page.ISSUED_CERTIFICATES;
|
||||
import static org.hamcrest.Matchers.hasSize;
|
||||
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
|
||||
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
//import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
|
||||
/**
|
||||
* Integration tests that test the URL End Points of IssuedCertificatesPageController.
|
||||
*/
|
||||
@ -135,7 +133,7 @@ public class IssuedCertificatesPageControllerTest extends PageControllerTest {
|
||||
*/
|
||||
@Test
|
||||
@Rollback
|
||||
public void getDeviceList() throws Exception {
|
||||
public void getIssuedCertsList() throws Exception {
|
||||
|
||||
// perform test
|
||||
getMockMvc().perform(MockMvcRequestBuilders.get(pagePath + "/list"))
|
||||
@ -144,6 +142,7 @@ public class IssuedCertificatesPageControllerTest extends PageControllerTest {
|
||||
.andExpect(jsonPath("$.data[0].platformCredentials",
|
||||
hasSize(platformCredentialList.size())))
|
||||
.andReturn();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package hirs.utils;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@ -11,21 +12,11 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
public class VersionHelperTest {
|
||||
|
||||
/**
|
||||
* Test that case where a version file does not exist.
|
||||
*/
|
||||
@Test
|
||||
public void testGetVersionFail() {
|
||||
String actual = VersionHelper.getVersion("somefile");
|
||||
assertTrue(actual.startsWith(""));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that a version file exists and can be read properly.
|
||||
* Test that a version file exists in /opt/hirs or /etc/hirs and is not empty.
|
||||
*/
|
||||
@Test
|
||||
public void testGetVersionDefault() {
|
||||
String expected = "Test.Version";
|
||||
String actual = VersionHelper.getVersion("VERSION");
|
||||
assertEquals(expected, actual);
|
||||
String actual = VersionHelper.getVersion();
|
||||
assertNotNull(actual);
|
||||
}
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
Test.Version
|
Loading…
Reference in New Issue
Block a user