Skip to content

Commit b181dcf

Browse files
authored
MOSIP-30573: test coverage movement to release branch (#500)
Signed-off-by: nagendra0721 <nagendra0718@gmail.com>
1 parent e79393f commit b181dcf

File tree

5 files changed

+2096
-27
lines changed

5 files changed

+2096
-27
lines changed

kernel/kernel-keymanager-service/src/test/java/io/mosip/kernel/signature/test/controller/SignatureControllerTest.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ public void tearDown() {
7676
keyAliasRepository.deleteAll();
7777
}
7878

79-
// ===== SignatureController endpoints =====
80-
8179
@Test
8280
public void testSignStatusOk() throws Exception {
8381
RequestWrapper<SignRequestDto> req = new RequestWrapper<>();
@@ -124,7 +122,7 @@ public void testValidateStatusOk() throws Exception {
124122
TimestampRequestDto dto = new TimestampRequestDto();
125123
dto.setData("eyAibW9kdWxlIjogImtleW1hbmFnZXIiLCAicHVycG9zZSI6ICJ0ZXN0IGNhc2UiIH0");
126124
dto.setSignature(signature);
127-
dto.setTimestamp(io.mosip.kernel.core.util.DateUtils.getUTCCurrentDateTime());
125+
dto.setTimestamp(io.mosip.kernel.core.util.DateUtils2.getUTCCurrentDateTime());
128126
req.setRequest(dto);
129127

130128
String content = mockMvc.perform(post("/validate")
@@ -144,23 +142,26 @@ public void testPdfSignStatusHandled() throws Exception {
144142
key.setReferenceId("");
145143
keymanagerService.generateMasterKey("CSR", key);
146144

145+
String pdfData = "JVBERi0xLjQKMSAwIG9iago8PAovVHlwZSAvQ2F0YWxvZwovUGFnZXMgMiAwIFIKPj4KZW5kb2JqCjIgMCBvYmoKPDwKL1R5cGUgL1BhZ2VzCi9LaWRzIFszIDAgUl0KL0NvdW50IDEKPD4KZW5kb2JqCjMgMCBvYmoKPDwKL1R5cGUgL1BhZ2UKL1BhcmVudCAyIDAgUgovTWVkaWFCb3ggWzAgMCA2MTIgNzkyXQo+PgplbmRvYmoKeHJlZgowIDQKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDA5IDAwMDAwIG4gCjAwMDAwMDAwNTggMDAwMDAgbiAKMDAwMDAwMDExNSAwMDAwMCBuIAp0cmFpbGVyCjw8Ci9TaXplIDQKL1Jvb3QgMSAwIFIKPj4Kc3RhcnR4cmVmCjE3NAolJUVPRg==";
147146
RequestWrapper<PDFSignatureRequestDto> req = new RequestWrapper<>();
148147
PDFSignatureRequestDto dto = new PDFSignatureRequestDto();
149148
dto.setApplicationId("TEST");
150149
dto.setReferenceId("");
151-
dto.setData("ZHVtbXkgcGRmIGNvbnRlbnQ=");
152-
dto.setTimeStamp(io.mosip.kernel.core.util.DateUtils.getUTCCurrentDateTimeString());
150+
dto.setData(pdfData);
151+
dto.setTimeStamp(io.mosip.kernel.core.util.DateUtils2.getUTCCurrentDateTimeString());
153152
dto.setPageNumber(1);
154-
dto.setLowerLeftX(10);
155-
dto.setLowerLeftY(10);
156-
dto.setUpperRightX(100);
157-
dto.setUpperRightY(100);
153+
dto.setLowerLeftX(100);
154+
dto.setLowerLeftY(100);
155+
dto.setUpperRightX(200);
156+
dto.setUpperRightY(150);
157+
dto.setReason("Test");
158+
dto.setPassword("1234");
158159
req.setRequest(dto);
159160

160161
String content = mockMvc.perform(post("/pdf/sign")
161162
.contentType(MediaType.APPLICATION_JSON)
162163
.content(objectMapper.writeValueAsString(req)))
163-
.andExpect(status().is2xxSuccessful())
164+
.andExpect(status().isOk())
164165
.andReturn().getResponse().getContentAsString();
165166

166167
com.fasterxml.jackson.databind.JsonNode root = objectMapper.readTree(content);

0 commit comments

Comments
 (0)