Skip to content

Commit

Permalink
Add golden test for drep metadata hash
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhammann committed Oct 12, 2023
1 parent c61f9e7 commit 0820946
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ module Test.Golden.Governance.DRep where

import Control.Monad (void)

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

import Hedgehog
import qualified Hedgehog as H
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import qualified Hedgehog.Extras.Test.Golden as H
Expand Down Expand Up @@ -76,3 +77,20 @@ hprop_golden_governance_drep_retirement_certificate =

H.assertFileOccurences 1 "CertificateShelley" certFile
H.assertFileOccurences 1 "DRep Retirement Certificate" certFile

hprop_golden_governance_drep_metadata_hash :: Property
hprop_golden_governance_drep_metadata_hash = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
goldenDRepMetadataHash <- noteInputFile "test/cardano-cli-golden/files/golden/governance/drep/drep_metadata_hash"

drepMetadataFile <- noteTempFile tempDir "drep-metadata.json"
H.evalIO $ writeFile drepMetadataFile "{ \"Lorem\": \"ipsum\", \"dolor\": \"sit\", \"amet\": \"consectetur\" }"

outputDRepMetadataHash <- H.noteTempFile tempDir "drep-metadata-hash.txt"

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

H.diffFileVsGoldenFile goldenDRepMetadataHash outputDRepMetadataHash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c9c4e907d758c260823be6999dbbcf2826ac1cdc0fe5f0c9394ac7fa17c74811
2 changes: 1 addition & 1 deletion cardano-cli/test/cardano-cli-golden/files/golden/help.cli
Original file line number Diff line number Diff line change
Expand Up @@ -6335,7 +6335,7 @@ Usage: cardano-cli conway governance drep metadata-hash --drep-metadata-file FIL

Usage: cardano-cli conway governance vote (create | view)

Vote commands.
Vote commands.

Usage: cardano-cli conway governance vote create (--yes | --no | --abstain)
--governance-action-tx-id TXID
Expand Down

0 comments on commit 0820946

Please sign in to comment.