Skip to content

Commit

Permalink
Add golden test for conway transaction assemble
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhammann committed Oct 12, 2023
1 parent 581fe89 commit 6e368ca
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions cardano-cli/cardano-cli.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ test-suite cardano-cli-golden
Test.Golden.Byron.UpdateProposal
Test.Golden.Byron.Vote
Test.Golden.Byron.Witness
Test.Golden.Conway.Transaction.Assemble
Test.Golden.EraBased.Governance.AnswerPoll
Test.Golden.EraBased.Governance.CreatePoll
Test.Golden.EraBased.Governance.VerifyPoll
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{-# LANGUAGE OverloadedStrings #-}

module Test.Golden.Conway.Transaction.Assemble where

import Control.Monad (void)

import Test.Cardano.CLI.Util

import Hedgehog (Property)
import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H

{- HLINT ignore "Use camelCase" -}

-- Check that we can assemble a txbody and a tx witness to form a transaction

hprop_golden_conwayTransactionAssembleWitness_SigningKey :: Property
hprop_golden_conwayTransactionAssembleWitness_SigningKey = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do
witnessTx <- noteTempFile tempDir "single-signing-key-witness-tx"
txBodyFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/txbody"
signingKeyWitnessFile <- noteInputFile "test/cardano-cli-golden/files/input/conway/singleSigningKeyWitness"
void $ execCardanoCLI
[ "conway", "transaction", "assemble"
, "--tx-body-file", txBodyFile
, "--witness-file", signingKeyWitnessFile
, "--witness-file", signingKeyWitnessFile
, "--out-file", witnessTx
]

H.assertFileOccurences 1 "Witnessed Tx ConwayEra" witnessTx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "TxWitness ConwayEra",
"description": "Key Witness ShelleyEra",
"cborHex": "825820c16f6bf723e38013f88588539fbbf1cd6b57bbbd8bb2cf318e641f00dcd527875840e62f3050bf7ee1d1547badd6f8346c00957b20c8d8f201fc8cf9d64485b3b3c944392afe00619516a00d98c6ccfa44a7de8c1a093efdc10832bb6fdf4cde8e08"
}
5 changes: 5 additions & 0 deletions cardano-cli/test/cardano-cli-golden/files/input/conway/txbody
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Unwitnessed Tx ConwayEra",
"description": "Ledger Cddl Format",
"cborHex": "84a5008182582054b5f2d5ed0fa142e724c9a982864d9e080b10648a66c8f7956eb3cc2cf16c0000018182581d6052e63f22c5107ed776b70f7b92248b02552fd08f3e747bc7450994411b0000000235cfef6d021a0002ff51031a0099d1dd04828a03581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d75820dacc52f2d73542ab0fc3b1f8051d00b0e50f1130935e5a21982bd289705852ae1b000000174876e8001b00000002540be400d81e82010a581de05e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c81581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c818400190bb9447f000001f682783268747470733a2f2f6d792d69702e61742f746573742f636f6e77617974657374706f6f6c2e6d657461646174612e6a736f6e58207cd083e6682892afc2b4e315fca93784f43dccde8bae1daa81db0b587e27155f83028200581c5e35891efec9c4a4e08d2a6a6d03598056d014e287618548e2556f8c581ce6eb963e591bc66401b5e1c763f4c9bc27adf58eb720f63c809981d7a0f5f6"
}

0 comments on commit 6e368ca

Please sign in to comment.