Skip to content

Commit

Permalink
adds tests for #73 (#74)
Browse files Browse the repository at this point in the history
* adds tests for #73
  • Loading branch information
m00sey authored Feb 1, 2023
1 parent 3ce1dea commit b935e7a
Show file tree
Hide file tree
Showing 8 changed files with 230 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"v": "ACDC10JSON00011c_",
"d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI",
"u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o",
"i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI",
"ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt",
"s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I",
"a": {
"d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg",
"i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0",
"dt": "2021-06-09T17:35:54.169967+00:00",
"LEI": "254900YH3ZCDPE1E5306",
"personLegalName": "Anne Jones",
"engagementContextRole": "Project Manager"
},
"e": {
"d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw",
"le": {
"n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24",
"s": "ENPXp1vQzRF6JwIuS-mp2U8Uf1MoADoP_GqQ62VsDZWY"
}
},
"r": {
"d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU",
"usageDisclaimer": {
"l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled."
},
"issuanceDisclaimer": {
"l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework."
},
"privacyDisclaimer": {
"l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"v": "ACDC10JSON00011c_",
"d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI",
"u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o",
"i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI",
"ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt",
"s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I",
"a": {
"d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg",
"i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0",
"dt": "2021-06-09T17:35:54.169967+00:00",
"LEI": "254900YH3ZCDPE1E5306",
"personLegalName": "Anne Jones",
"engagementContextRole": "Project Manager"
},
"e": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw",
"r": {
"d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU",
"usageDisclaimer": {
"l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled."
},
"issuanceDisclaimer": {
"l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework."
},
"privacyDisclaimer": {
"l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"v": "ACDC10JSON00011c_",
"d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI",
"u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o",
"i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI",
"ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt",
"s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I",
"a": {
"d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg",
"i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0",
"dt": "2021-06-09T17:35:54.169967+00:00",
"LEI": "254900YH3ZCDPE1E5306",
"personLegalName": "Anne Jones",
"engagementContextRole": "Project Manager"
},
"e": {
"d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw",
"auth": {
"n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24"
}
},
"r": {
"d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU",
"usageDisclaimer": {
"l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled."
},
"issuanceDisclaimer": {
"l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework."
},
"privacyDisclaimer": {
"l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"v": "ACDC10JSON00011c_",
"d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI",
"u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o",
"i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI",
"ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt",
"s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I",
"a": {
"d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg",
"i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0",
"dt": "2021-06-09T17:35:54.169967+00:00",
"LEI": "254900YH3ZCDPE1E5306",
"personLegalName": "Anne Jones",
"engagementContextRole": "Project Manager"
},
"e": {
"d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw",
"bad": {
"n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24",
"s": "ENPXp1vQzRF6JwIuS-mp2U8Uf1MoADoP_GqQ62VsDZWY"
}
},
"r": {
"d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU",
"usageDisclaimer": {
"l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled."
},
"issuanceDisclaimer": {
"l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework."
},
"privacyDisclaimer": {
"l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"v": "ACDC10JSON00011c_",
"d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI",
"u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o",
"i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI",
"ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt",
"s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I",
"a": {
"d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg",
"i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0",
"dt": "2021-06-09T17:35:54.169967+00:00",
"LEI": "254900YH3ZCDPE1E5306",
"personLegalName": "Anne Jones",
"engagementContextRole": "Project Manager"
},
"e": {
"d": "EBDmgKOAEwnMGsofWg2m0l63J1awfJafqJyCzTnVkdSw",
"le": {
"n": "Et2DOOu4ivLsjpv89vgv6auPntSLx4CvOhGUxMhxPS24"
}
},
"r": {
"d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU",
"usageDisclaimer": {
"l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled."
},
"issuanceDisclaimer": {
"l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework."
},
"privacyDisclaimer": {
"l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification."
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"v": "ACDC10JSON00011c_",
"d": "EpcEvrX2gGTpmKbIG25GSA7_LsWwwzVQ6aUilgBubpGI",
"u": "IY7-g7wTfta1087YAdUXTbuI0Vklqt8pQxTgc3Rtz0o",
"i": "did:keri:EmSIYYxvgtKn9jAp8GcK3fXOwTeyBIcAnRnyrLNfKjVI",
"ri": "did:keri:EymRy7xMwsxUelUauaXtMxTfPAMPAI6FkekwlOjkggt",
"s": "EZdaE1HCu2ZhyIhpXTWfGSLS2kirKexaC-4up3sIUz1I",
"a": {
"d": "EG7PfBZbyXS0huxbnvMD-jOdTnDCCaT4CO6xId-ATNWg",
"i": "did:keri:EFs6d-7q-l6tDMn_yYFyFzaT89sSFNLCOaKqYMF-7L_0",
"dt": "2021-06-09T17:35:54.169967+00:00",
"LEI": "254900YH3ZCDPE1E5306",
"personLegalName": "Anne Jones",
"engagementContextRole": "Project Manager"
},
"r": {
"d": "EDIai3Wkd-Z_4cezz9nYEcCK3KNH5saLvZoS_84JL6NU",
"usageDisclaimer": {
"l": "Usage of a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, does not assert that the Legal Entity is trustworthy, honest, reputable in its business dealings, safe to do business with, or compliant with any laws or that an implied or expressly intended purpose will be fulfilled."
},
"issuanceDisclaimer": {
"l": "All information in a valid, unexpired, and non-revoked vLEI Credential, as defined in the associated Ecosystem Governance Framework, is accurate as of the date the validation process was complete. The vLEI Credential has been issued to the legal entity or person named in the vLEI Credential as the subject; and the qualified vLEI Issuer exercised reasonable care to perform the validation process set forth in the vLEI Ecosystem Governance Framework."
},
"privacyDisclaimer": {
"l": "It is the sole responsibility of Holders as Issuees of an ECR vLEI Credential to present that Credential in a privacy-preserving manner using the mechanisms provided in the Issuance and Presentation Exchange (IPEX) protocol specification and the Authentic Chained Data Container (ACDC) specification. https://github.com/WebOfTrust/IETF-IPEX and https://github.com/trustoverip/tswg-acdc-specification."
}
}
}
36 changes: 35 additions & 1 deletion tests/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

import pytest
from keri.core import scheming, coring
from keri.kering import ValidationError


@pytest.mark.parametrize("filename", ["verifiable-ixbrl-report-attestation.json",
"legal-entity-engagement-context-role-vLEI-credential.json",
"legal-entity-official-organizational-role-vLEI-credential.json",
"legal-entity-vLEI-credential.json",
"qualified-vLEI-issuer-vLEI-credential.json",
Expand All @@ -21,6 +21,40 @@ def test_schema_example(fmt, filename):
schemer.verify(sample.read().encode("utf-8"))


@pytest.mark.parametrize("sample", [
"legal-entity-engagement-context-role-vLEI-credential-auth.json",
"legal-entity-engagement-context-role-vLEI-credential-le.json",
"legal-entity-engagement-context-role-vLEI-credential-said.json",
])
@pytest.mark.parametrize("schema", ["legal-entity-engagement-context-role-vLEI-credential.json", ])
@pytest.mark.parametrize("fmt", ["acdc"])
def test_ecr_schema_with_good(fmt, schema, sample):
with open(f'{Path(__file__).parent}/../schema/{fmt}/{schema}', 'r') as schma, \
open(f'{Path(__file__).parent}/../samples/acdc/{sample}', 'r') as smple:
schemer = scheming.Schemer(sed=json.load(schma))

assert schemer.verify(smple.read().encode("utf-8"))


@pytest.mark.parametrize("sample", [
"legal-entity-engagement-context-role-vLEI-credential-bad.json",
"legal-entity-engagement-context-role-vLEI-credential-auth-bad.json",
"legal-entity-engagement-context-role-vLEI-credential-le-bad.json",
"legal-entity-engagement-context-role-vLEI-credential-missing-bad.json",
])
@pytest.mark.parametrize("schema", ["legal-entity-engagement-context-role-vLEI-credential.json", ])
@pytest.mark.parametrize("fmt", ["acdc"])
def test_ecr_schema_with_bad(fmt, schema, sample):
with open(f'{Path(__file__).parent}/../schema/{fmt}/{schema}', 'r') as schma, \
open(f'{Path(__file__).parent}/../test-vectors/{fmt}/ecr-failures/{sample}', 'r') as smple:
schemer = scheming.Schemer(sed=json.load(schma))

with pytest.raises(ValidationError) as e:
schemer.verify(smple.read().encode("utf-8"))

assert e.type is ValidationError


def test_legal_entity_chain():
qvi = json.load(open(f'{__path()}/../schema/acdc/qualified-vLEI-issuer-vLEI-credential.json', 'r'))
le = json.load(open(f'{__path()}/../schema/acdc/legal-entity-vLEI-credential.json', 'r'))
Expand Down

0 comments on commit b935e7a

Please sign in to comment.