Skip to content

Commit

Permalink
adds tests for #73
Browse files Browse the repository at this point in the history
  • Loading branch information
m00sey committed Jan 6, 2023
1 parent 3ce1dea commit 424ed59
Show file tree
Hide file tree
Showing 5 changed files with 129 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",
"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,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."
}
}
}
31 changes: 30 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 @@ -28,6 +28,35 @@ def test_legal_entity_chain():
assert le['properties']['e']['oneOf'][1]['properties']['qvi']["properties"]['s']['const'] == qvi[coring.Ids.dollar]


@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_auth(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",
])
@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}/../samples/acdc/{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_ecr_auth_chain():
auth = json.load(open(f'{__path()}/../schema/acdc/ecr-authorization-vlei-credential.json', 'r'))

Expand Down

0 comments on commit 424ed59

Please sign in to comment.