Skip to content

Commit

Permalink
feat: test case of validate vc wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thackerronak committed Jun 2, 2023
1 parent 9d6a49d commit 2123468
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ void getCredentials200() throws com.fasterxml.jackson.core.JsonProcessingExcepti
Assertions.assertEquals(1, Objects.requireNonNull(credentialList).size());
}

@Test
void validateCredentials200() throws com.fasterxml.jackson.core.JsonProcessingException {
String bpn = UUID.randomUUID().toString();

HttpHeaders headers = AuthenticationUtils.getValidUserHttpHeaders(bpn);
TestUtils.createWallet(bpn, "Test", restTemplate);
ResponseEntity<String> vc = TestUtils.issueMembershipVC(restTemplate, bpn, miwSettings.authorityWalletBpn());
VerifiableCredential verifiableCredential = new VerifiableCredential(new ObjectMapper().readValue(vc.getBody(), Map.class));
Map<String, Objects> map = objectMapper.readValue(verifiableCredential.toJson(), Map.class);
HttpEntity<Map> entity = new HttpEntity<>(map, headers);
// ResponseEntity<Map> response = restTemplate.exchange(RestURI.CREDENTIALS_VALIDATION, HttpMethod.POST, entity, Map.class);
// Boolean valid = proofValidation.checkProof(verifiableCredential);
// Assertions.assertEquals(HttpStatus.OK.value(), response.getStatusCode().value());// TODO did will resolved
// Assertions.assertTrue((Boolean) response.getBody().get("valid")); //TODO getting false from lib

}


private List<VerifiableCredential> getCredentialsFromString(String body) throws com.fasterxml.jackson.core.JsonProcessingException {
List<VerifiableCredential> credentialList = new ArrayList<>();
Expand Down

0 comments on commit 2123468

Please sign in to comment.