diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java index f4348f7..8f6d59e 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/OB20Tests.java @@ -108,6 +108,16 @@ public class OB20Tests { }); } + @Test + void testNoPublicKeyInIssuer() { + assertDoesNotThrow(()->{ + Report report = validator.run(Samples.OB20.JSON.SIMPLE_ASSERTION_ISSUER_WITHOUT_PUBLIC_KEY_JSON.asFileResource()); + if(verbose) PrintHelper.print(report, true); + assertValid(report); + // check than + }); + } + @Nested static class WarningTests { @BeforeAll diff --git a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java index daabbaa..e7ee0e6 100644 --- a/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java +++ b/inspector-vc/src/test/java/org/oneedtech/inspect/vc/Samples.java @@ -47,6 +47,8 @@ public class Samples { public final static Sample SIMPLE_ASSERTION_JSON = new Sample("ob20/basic-assertion.json", true); public final static Sample SIMPLE_ASSERTION_INVALID_CONTEXT_JSON = new Sample("ob20/basic-assertion-invalid-context.json", true); public final static Sample SIMPLE_ASSERTION_INVALID_TYPE_JSON = new Sample("ob20/basic-assertion-invalid-type.json", true); + // original: + public final static Sample SIMPLE_ASSERTION_ISSUER_WITHOUT_PUBLIC_KEY_JSON = new Sample("ob20/basic-assertion-no-public-key.json", true); // original: test_graph: test_verify_with_redirection public final static Sample WARNING_REDIRECTION_ASSERTION_JSON = new Sample("ob20/warning-with-redirection.json", true); // original: test_validation: test_issuer_warn_on_non_https_id diff --git a/inspector-vc/src/test/resources/ob20/assets/basic-badge-no-public-key.json b/inspector-vc/src/test/resources/ob20/assets/basic-badge-no-public-key.json new file mode 100644 index 0000000..f47916b --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/assets/basic-badge-no-public-key.json @@ -0,0 +1,10 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "type": "BadgeClass", + "id": "https://example.org/basic-badge-no-public-key.json", + "name": "Awesome Robotics Badge", + "description": "For doing awesome things with robots that people think is pretty great.", + "image": "https://example.org/robotics-badge.png", + "criteria": "https://example.org/badgecriteria.json", + "issuer": "https://example.org/organization-no-public-key.json" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/assets/organization-no-public-key.json b/inspector-vc/src/test/resources/ob20/assets/organization-no-public-key.json new file mode 100644 index 0000000..9687d0b --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/assets/organization-no-public-key.json @@ -0,0 +1,8 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "type": "Issuer", + "id": "https://example.org/organization-no-public-key.json", + "name": "An Example Badge Issuer", + "url": "https://example.org", + "email": "contact@example.org" +} \ No newline at end of file diff --git a/inspector-vc/src/test/resources/ob20/basic-assertion-no-public-key.json b/inspector-vc/src/test/resources/ob20/basic-assertion-no-public-key.json new file mode 100644 index 0000000..e68a678 --- /dev/null +++ b/inspector-vc/src/test/resources/ob20/basic-assertion-no-public-key.json @@ -0,0 +1,18 @@ +{ + "@context": "https://w3id.org/openbadges/v2", + "type": "Assertion", + "id": "https://example.org/beths-robotics-badge.json", + "recipient": { + "type": "email", + "hashed": true, + "salt": "deadsea", + "identity": "sha256$ecf5409f3f4b91ab60cc5ef4c02aef7032354375e70cf4d8e43f6a1d29891942" + }, + "image": "https://example.org/beths-robot-badge.png", + "evidence": "https://example.org/beths-robot-work.html", + "issuedOn": "2016-12-31T23:59:59Z", + "badge": "https://example.org/basic-badge-no-public-key.json", + "verification": { + "type": "hosted" + } +} \ No newline at end of file