Added test for assertion withou publick key

This commit is contained in:
Xavi Aracil 2022-12-12 10:40:12 +01:00
parent 48a3de0968
commit e4da345869
5 changed files with 48 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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"
}

View File

@ -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"
}

View File

@ -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"
}
}