Skip to content

Commit

Permalink
Merge pull request #379 from input-output-hk/smelc/test-governance-dr…
Browse files Browse the repository at this point in the history
…ep-registration-certificate

drep registration-certificate: add a golden test
  • Loading branch information
smelc committed Oct 18, 2023
2 parents b83c58d + b457ca2 commit e3a8dce
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Test.Golden.Governance.DRep where

import Control.Monad (void)

import Test.Cardano.CLI.Util (execCardanoCLI, noteInputFile, propertyOnce, noteTempFile)
import Test.Cardano.CLI.Util (execCardanoCLI, noteInputFile, noteTempFile, propertyOnce)

import Hedgehog
import qualified Hedgehog as H
Expand Down Expand Up @@ -94,3 +94,21 @@ hprop_golden_governance_drep_metadata_hash = propertyOnce . H.moduleWorkspace "t
]

H.diffFileVsGoldenFile goldenDRepMetadataHash outputDRepMetadataHash

hprop_golden_governance_drep_registration_certificate :: Property
hprop_golden_governance_drep_registration_certificate = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
drepKeyFile <- noteInputFile "test/cardano-cli-golden/files/golden/governance/drep/drep.vkey"
goldenFile <- noteInputFile "test/cardano-cli-golden/files/golden/governance/drep/drep_registration_certificate.json"

outFile <- H.noteTempFile tempDir "drep-reg-cert.txt"

void $ execCardanoCLI
[ "conway", "governance", "drep", "registration-certificate"
, "--drep-verification-key-file", drepKeyFile
, "--key-reg-deposit-amt", "0"
, "--drep-metadata-url", "dummy-url"
, "--drep-metadata-hash", "52e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
, "--out-file", outFile
]

H.diffFileVsGoldenFile goldenFile outFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "DRepVerificationKey_ed25519",
"description": "Delegate Representative Verification Key",
"cborHex": "582063a24b920d31119c5b06bd7bf64941b215f2de501b3ec7d2a7e65081fb4e999c"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "CertificateShelley",
"description": "DRep Key Registration Certificate",
"cborHex": "84108200581ce68f9ee70599cb93d9f60678f9c6463c01938c27d9820c7bf93887a500826964756d6d792d75726c582052e69500a92d80f2126c836a4903dc582006709f004cf7a28ed648f732dff8d2"
}

0 comments on commit e3a8dce

Please sign in to comment.