Add valid endorsement test

This commit is contained in:
Andy Miller (IMS) 2022-12-20 13:00:26 -08:00
parent df646b502b
commit eb5cd65985
3 changed files with 49 additions and 1 deletions

View File

@ -4,11 +4,11 @@ import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.oneedtech.inspect.test.Assertions.assertFatalCount; import static org.oneedtech.inspect.test.Assertions.assertFatalCount;
import static org.oneedtech.inspect.test.Assertions.assertHasProbeID; import static org.oneedtech.inspect.test.Assertions.assertHasProbeID;
import static org.oneedtech.inspect.test.Assertions.assertInvalid; import static org.oneedtech.inspect.test.Assertions.assertInvalid;
import static org.oneedtech.inspect.test.Assertions.assertValid;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
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.CredentialParseProbe; import org.oneedtech.inspect.vc.probe.CredentialParseProbe;
@ -25,6 +25,15 @@ public class Endorsement30Tests {
.build(); .build();
} }
@Test
void testEndorsementWithoutErrors() {
assertDoesNotThrow(()->{
Report report = validator.run(Samples.OB30.JSON.ENDORSEMENT_VALID.asFileResource());
if(verbose) PrintHelper.print(report, true);
assertValid(report);
});
}
@Test @Test
void testEndorsementWithErrors() { void testEndorsementWithErrors() {
assertDoesNotThrow(()->{ assertDoesNotThrow(()->{

View File

@ -24,6 +24,7 @@ public class Samples {
public final static Sample SIMPLE_JSON_ISSUER = new Sample("ob30/simple-err-issuer.json", false); public final static Sample SIMPLE_JSON_ISSUER = new Sample("ob30/simple-err-issuer.json", false);
public final static Sample SIMPLE_JSON_ERR_CONTEXT = new Sample("ob30/simple-err-context.json", false); public final static Sample SIMPLE_JSON_ERR_CONTEXT = new Sample("ob30/simple-err-context.json", false);
public final static Sample ENDORSEMENT_ERR_SCHEMA_STATUS_REFRESH = new Sample("ob30/endorsement-err-schema-status-refresh.json", false); public final static Sample ENDORSEMENT_ERR_SCHEMA_STATUS_REFRESH = new Sample("ob30/endorsement-err-schema-status-refresh.json", false);
public final static Sample ENDORSEMENT_VALID = new Sample("ob30/endorsement-valid.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);

View File

@ -0,0 +1,38 @@
{
"@context": [
"https://www.w3.org/2018/credentials/v1",
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
"https://purl.imsglobal.org/spec/ob/v3p0/extensions.json",
"https://w3id.org/security/suites/ed25519-2020/v1"
],
"id": "http://1edtech.edu/endorsementcredential/3732",
"type": [
"VerifiableCredential",
"EndorsementCredential"
],
"issuer": {
"id": "https://state.gov/issuers/565049",
"type": "Profile",
"name": "State Department of Education"
},
"issuanceDate": "2010-01-01T00:00:00Z",
"expirationDate": "2030-01-01T00:00:00Z",
"credentialSubject": {
"id": "https://1edtech.edu/issuers/565049",
"type": "EndorsementSubject",
"endorsementComment": "1EdTech University is in good standing"
},
"credentialSchema": [
{
"id": "https://purl.imsglobal.org/spec/ob/v3p0/schema/json/ob_v3p0_endorsementcredential_schema.json",
"type": "1EdTechJsonSchemaValidator2019"
}
],
"proof": {
"type": "Ed25519Signature2020",
"created": "2022-12-20T20:56:10Z",
"proofPurpose": "assertionMethod",
"verificationMethod": "did:key:z6MkgG59UvkBM1Lfv2D9JBu6yHn7aKurbwQgs1h5NCYJEk35",
"proofValue": "zLJF9oRBcpVQ9HUt8BRfPevvEGwL74bSyBKDpGzjNpb3KtMQ8JhQDPq3C4sqojneNz74YFWkjLSntC93iZGVscta"
}
}