Skip to content

Commit

Permalink
Update golden tests to use test vector from CIP 119
Browse files Browse the repository at this point in the history
preserve old test
add new test for cip119
  • Loading branch information
CarlosLopezDeLara authored and palas committed Jul 15, 2024
1 parent bbce2ba commit 5d84467
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@ hprop_golden_governance_drep_metadata_hash = propertyOnce . H.moduleWorkspace "t

H.diffFileVsGoldenFile outputDRepMetadataHash goldenDRepMetadataHash

-- Execute me with:
-- @cabal test cardano-cli-golden --test-options '-p "/golden governance drep metadata hash cip119/"'@
hprop_golden_governance_drep_metadata_hash_cip119 :: Property
hprop_golden_governance_drep_metadata_hash_cip119 = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
goldenDRepMetadataHashCip119 <- H.note "test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash_cip119"

--Use jsonld file from test vector of CIP119 https://github.com/cardano-foundation/CIPs/blob/master/CIP-0119/test-vector.md
drepMetadataFile <- noteInputFile "test/cardano-cli-golden/files/input/governance/drep/drep.jsonld"

outputDRepMetadataHashCip119 <- H.noteTempFile tempDir "drep-metadata-hash-cip119.txt"

void $ execCardanoCLI
[ "conway", "governance", "drep","metadata-hash"
, "--drep-metadata-file", drepMetadataFile
, "--out-file", outputDRepMetadataHashCip119
]

H.diffFileVsGoldenFile outputDRepMetadataHashCip119 goldenDRepMetadataHashCip119

hprop_golden_governance_drep_registration_certificate_vkey_file :: Property
hprop_golden_governance_drep_registration_certificate_vkey_file = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
drepVKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/drep.vkey"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a14a5ad4f36bddc00f92ddb39fd9ac633c0fd43f8bfa57758f9163d10ef916de
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"@context": {
"CIP100": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0100/README.md#",
"CIP119": "https://github.com/cardano-foundation/CIPs/blob/master/CIP-0119/README.md#",
"hashAlgorithm": "CIP100:hashAlgorithm",
"body": {
"@id": "CIP119:body",
"@context": {
"references": {
"@id": "CIP119:references",
"@container": "@set",
"@context": {
"GovernanceMetadata": "CIP100:GovernanceMetadataReference",
"Other": "CIP100:OtherReference",
"label": "CIP100:reference-label",
"uri": "CIP100:reference-uri"
}
},
"paymentAddress": "CIP119:paymentAddress",
"givenName": "CIP119:givenName",
"image": {
"@id": "CIP119:image",
"@context": {
"ImageObject": "https://schema.org/ImageObject"
}
},
"objectives": "CIP119:objectives",
"motivations": "CIP119:motivations",
"qualifications": "CIP119:qualifications"
}
}
},
"hahsAlgorithm": "blake2b-256",
"body": {
"paymentAddress": "addr1q86dnpkva4mm859c8ur7tjxn57zgsu6vg8pdetkdve3fsacnq7twy06u2ev5759vutpjgzfryx0ud8hzedhzerava35qwh3x34",
"givenName": "Ryan Williams",
"image": {
"@type": "ImageObject",
"contentUrl": "https://avatars.githubusercontent.com/u/44342099?v=4",
"sha256": "2a21e4f7b20c8c72f573707b068fb8fc6d8c64d5035c4e18ecae287947fe2b2e"
},
"objectives": "Buy myself an island.",
"motivations": "I really would like to own an island.",
"qualifications": "I have my 100m swimming badge, so I would be qualified to be able to swim around island.",
"references": [
{
"@type": "Other",
"label": "A cool island for Ryan",
"uri": "https://www.google.com/maps/place/World's+only+5th+order+recursive+island/@62.6511465,-97.7946829,15.75z/data=!4m14!1m7!3m6!1s0x5216a167810cee39:0x11431abdfe4c7421!2sWorld's+only+5th+order+recursive+island!8m2!3d62.651114!4d-97.7872244!16s%2Fg%2F11spwk2b6n!3m5!1s0x5216a167810cee39:0x11431abdfe4c7421!8m2!3d62.651114!4d-97.7872244!16s%2Fg%2F11spwk2b6n?authuser=0&entry=ttu"
},
{
"@type": "Link",
"label": "Ryan's Twitter",
"uri": "https://twitter.com/Ryun1_"
}
]
}
}

0 comments on commit 5d84467

Please sign in to comment.