add unit test for JsonSchemaProbe
This commit is contained in:
parent
a766a83fd0
commit
67232f5b1d
@ -25,7 +25,6 @@ public class ExpirationVerifierProbe extends Probe<Credential> {
|
|||||||
* If the AchievementCredential or EndorsementCredential has an “expirationDate” property
|
* If the AchievementCredential or EndorsementCredential has an “expirationDate” property
|
||||||
* and the expiration date is prior to the current date, the credential has expired.
|
* and the expiration date is prior to the current date, the credential has expired.
|
||||||
*/
|
*/
|
||||||
System.err.println("ExpirationVerifierProbe");
|
|
||||||
JsonNode node = crd.getJson().get("expirationDate");
|
JsonNode node = crd.getJson().get("expirationDate");
|
||||||
if(node != null) {
|
if(node != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -7,6 +7,7 @@ import org.junit.jupiter.api.BeforeAll;
|
|||||||
import org.junit.jupiter.api.Disabled;
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.oneedtech.inspect.core.Inspector.Behavior;
|
import org.oneedtech.inspect.core.Inspector.Behavior;
|
||||||
|
import org.oneedtech.inspect.core.probe.json.JsonSchemaProbe;
|
||||||
import org.oneedtech.inspect.core.report.Report;
|
import org.oneedtech.inspect.core.report.Report;
|
||||||
import org.oneedtech.inspect.test.PrintHelper;
|
import org.oneedtech.inspect.test.PrintHelper;
|
||||||
import org.oneedtech.inspect.vc.probe.ExpirationVerifierProbe;
|
import org.oneedtech.inspect.vc.probe.ExpirationVerifierProbe;
|
||||||
@ -108,6 +109,17 @@ public class OB30Tests {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testSimpleJsonSchemaError() throws Exception {
|
||||||
|
//issuer removed
|
||||||
|
assertDoesNotThrow(()->{
|
||||||
|
Report report = validator.run(Samples.OB30.JSON.SIMPLE_JSON_ISSUER.asFileResource());
|
||||||
|
if(verbose) PrintHelper.print(report, true);
|
||||||
|
assertInvalid(report);
|
||||||
|
assertHasProbeID(report, JsonSchemaProbe.ID, true);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Disabled //TODO IssuanceVerifierProbe is not run because FATAL: InvalidSignature terminates
|
@Disabled //TODO IssuanceVerifierProbe is not run because FATAL: InvalidSignature terminates
|
||||||
@Test
|
@Test
|
||||||
void testSimpleJsonNotIssued() {
|
void testSimpleJsonNotIssued() {
|
||||||
|
@ -16,6 +16,7 @@ public class Samples {
|
|||||||
public final static Sample SIMPLE_JSON_PROOF_ERROR = new Sample("ob30/simple-proof-error.json", false);
|
public final static Sample SIMPLE_JSON_PROOF_ERROR = new Sample("ob30/simple-proof-error.json", false);
|
||||||
public final static Sample SIMPLE_JSON_EXPIRED = new Sample("ob30/simple-expired.json", false);
|
public final static Sample SIMPLE_JSON_EXPIRED = new Sample("ob30/simple-expired.json", false);
|
||||||
public final static Sample SIMPLE_JSON_ISSUED = new Sample("ob30/simple-issued.json", false);
|
public final static Sample SIMPLE_JSON_ISSUED = new Sample("ob30/simple-issued.json", false);
|
||||||
|
public final static Sample SIMPLE_JSON_ISSUER = new Sample("ob30/simple-issuer.json", false);
|
||||||
}
|
}
|
||||||
public static final class PNG {
|
public static final class PNG {
|
||||||
public final static Sample SIMPLE_JWT_PNG = new Sample("ob30/simple-jwt.png", true);
|
public final static Sample SIMPLE_JWT_PNG = new Sample("ob30/simple-jwt.png", true);
|
||||||
|
29
inspector-vc/src/test/resources/ob30/simple-issuer.json
Normal file
29
inspector-vc/src/test/resources/ob30/simple-issuer.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/2018/credentials/v1",
|
||||||
|
"https://imsglobal.github.io/openbadges-specification/context.json",
|
||||||
|
"https://w3id.org/security/suites/ed25519-2020/v1"
|
||||||
|
],
|
||||||
|
"id": "http://example.edu/credentials/3732",
|
||||||
|
"type": [
|
||||||
|
"VerifiableCredential",
|
||||||
|
"OpenBadgeCredential"
|
||||||
|
],
|
||||||
|
"issuanceDate": "2010-01-01T00:00:00Z",
|
||||||
|
"name": "Example University Degree",
|
||||||
|
"credentialSubject": {
|
||||||
|
"id": "did:example:ebfeb1f712ebc6f1c276e12ec21",
|
||||||
|
"type": [
|
||||||
|
"AchievementSubject"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"proof": [
|
||||||
|
{
|
||||||
|
"type": "Ed25519Signature2020",
|
||||||
|
"created": "2022-06-28T16:28:36Z",
|
||||||
|
"verificationMethod": "did:key:z6MkkUD3J14nkYzn46QeuaVSnp7dF85QJKwKvJvfsjx79aXj",
|
||||||
|
"proofPurpose": "assertionMethod",
|
||||||
|
"proofValue": "z3MUt2ZuU8Byqivxh6GphEM65AFYyNaGYibm97xLTafM7uGufZQLKvJR8itZwxKskvtFM3CUty46v26DZidMNoQnM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user