From a25eb842206c9b28d47af741689f0b761eec8bc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Hurlin?= Date: Wed, 11 Oct 2023 11:21:39 +0200 Subject: [PATCH] Add test of voting using a cc hot key --- .../Test/Golden/Governance/Vote.hs | 54 +++++++++++++++++++ .../governance/vote/vote_cc_abstain.json | 5 ++ .../golden/governance/vote/vote_cc_no.json | 5 ++ .../golden/governance/vote/vote_cc_yes.json | 5 ++ .../cardano-cli-golden/files/input/cc.vkey | 5 ++ 5 files changed, 74 insertions(+) create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_abstain.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_no.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_yes.json create mode 100644 cardano-cli/test/cardano-cli-golden/files/input/cc.vkey diff --git a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs index a8ca4ad966..8d828429d4 100644 --- a/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs +++ b/cardano-cli/test/cardano-cli-golden/Test/Golden/Governance/Vote.hs @@ -66,3 +66,57 @@ hprop_golden_governance_governance_vote_view_yaml = ] H.diffVsGoldenFile voteView voteViewGold + +hprop_golden_governance_governance_vote_create_yes_cc_hot_key :: Property +hprop_golden_governance_governance_vote_create_yes_cc_hot_key = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + ccVkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/cc.vkey" + voteFile <- H.noteTempFile tempDir "vote" + voteGold <- H.note "test/cardano-cli-golden/files/golden/governance/vote/vote_cc_yes.json" + + void $ execCardanoCLI + [ "conway", "governance", "vote", "create" + , "--yes" + , "--governance-action-tx-id", "d21d997b5dbdd90180b642c3f4f2653cea629f6134cd9dc820d0fe6f11b54af4" + , "--governance-action-index", "0" + , "--cc-hot-verification-key-file", ccVkeyFile + , "--out-file", voteFile + ] + + H.diffFileVsGoldenFile voteFile voteGold + +hprop_golden_governance_governance_vote_create_no_cc_hot_key :: Property +hprop_golden_governance_governance_vote_create_no_cc_hot_key = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + ccVkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/cc.vkey" + voteFile <- H.noteTempFile tempDir "vote" + voteGold <- H.note "test/cardano-cli-golden/files/golden/governance/vote/vote_cc_no.json" + + void $ execCardanoCLI + [ "conway", "governance", "vote", "create" + , "--no" + , "--governance-action-tx-id", "d21d997b5dbdd90180b642c3f4f2653cea629f6134cd9dc820d0fe6f11b54af4" + , "--governance-action-index", "0" + , "--cc-hot-verification-key-file", ccVkeyFile + , "--out-file", voteFile + ] + + H.diffFileVsGoldenFile voteFile voteGold + +hprop_golden_governance_governance_vote_create_abstain_cc_hot_key :: Property +hprop_golden_governance_governance_vote_create_abstain_cc_hot_key = + propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do + ccVkeyFile <- noteInputFile "test/cardano-cli-golden/files/input/cc.vkey" + voteFile <- H.noteTempFile tempDir "vote" + voteGold <- H.note "test/cardano-cli-golden/files/golden/governance/vote/vote_cc_abstain.json" + + void $ execCardanoCLI + [ "conway", "governance", "vote", "create" + , "--abstain" + , "--governance-action-tx-id", "d21d997b5dbdd90180b642c3f4f2653cea629f6134cd9dc820d0fe6f11b54af4" + , "--governance-action-index", "0" + , "--cc-hot-verification-key-file", ccVkeyFile + , "--out-file", voteFile + ] + + H.diffFileVsGoldenFile voteFile voteGold diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_abstain.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_abstain.json new file mode 100644 index 0000000000..fa78ec3254 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_abstain.json @@ -0,0 +1,5 @@ +{ + "type": "Governance voting procedures", + "description": "", + "cborHex": "a18200581c96ded47e88ee07c28ec3c2bf5ea156e37e544ff5beb5348d3c653282a1825820d21d997b5dbdd90180b642c3f4f2653cea629f6134cd9dc820d0fe6f11b54af4008202f6" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_no.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_no.json new file mode 100644 index 0000000000..13b83a7b58 --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_no.json @@ -0,0 +1,5 @@ +{ + "type": "Governance voting procedures", + "description": "", + "cborHex": "a18200581c96ded47e88ee07c28ec3c2bf5ea156e37e544ff5beb5348d3c653282a1825820d21d997b5dbdd90180b642c3f4f2653cea629f6134cd9dc820d0fe6f11b54af4008200f6" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_yes.json b/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_yes.json new file mode 100644 index 0000000000..56cb4220ec --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/golden/governance/vote/vote_cc_yes.json @@ -0,0 +1,5 @@ +{ + "type": "Governance voting procedures", + "description": "", + "cborHex": "a18200581c96ded47e88ee07c28ec3c2bf5ea156e37e544ff5beb5348d3c653282a1825820d21d997b5dbdd90180b642c3f4f2653cea629f6134cd9dc820d0fe6f11b54af4008201f6" +} diff --git a/cardano-cli/test/cardano-cli-golden/files/input/cc.vkey b/cardano-cli/test/cardano-cli-golden/files/input/cc.vkey new file mode 100644 index 0000000000..508046405e --- /dev/null +++ b/cardano-cli/test/cardano-cli-golden/files/input/cc.vkey @@ -0,0 +1,5 @@ +{ + "type": "ConstitutionalCommitteeHotVerificationKey_ed25519", + "description": "Constitutional Committee Hot Verification Key", + "cborHex": "5820b604f364de66ede115fb24d7b301042effd43133405d5f2e2646f7cad426b8b7" +}