Skip to content

Commit

Permalink
Shelley/Sign: goldenize tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Nov 6, 2023
1 parent 9f78897 commit eb5fa26
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import Test.Cardano.CLI.Util

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

{- HLINT ignore "Use camelCase" -}

hprop_golden_shelleyTransactionSign :: Property
hprop_golden_shelleyTransactionSign = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do
hprop_golden_shelley_transaction_sign :: Property
hprop_golden_shelley_transaction_sign = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do
txBodyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/tx/txbody"
initialUtxo1SigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/keys/payment_keys/signing_key"
utxoSigningKeyFile <- noteInputFile "test/cardano-cli-golden/files/input/shelley/transaction-sign/utxo.skey"
Expand All @@ -33,8 +33,8 @@ hprop_golden_shelleyTransactionSign = propertyOnce $ H.moduleWorkspace "tmp" $ \
, "--tx-file", signedTransactionFile
]

H.assertFileOccurences 1 "Tx MaryEra" signedTransactionFile
H.assertEndsWithSingleNewline signedTransactionFile
goldenFile1 <- H.note "test/cardano-cli-golden/files/golden/shelley/transaction-sign-1.json"
H.diffFileVsGoldenFile signedTransactionFile goldenFile1

-- Sign for a testnet with a testnet network magic of 11, but use two signing keys

Expand All @@ -47,8 +47,7 @@ hprop_golden_shelleyTransactionSign = propertyOnce $ H.moduleWorkspace "tmp" $ \
, "--tx-file", signedTransactionFile
]

H.assertFileOccurences 1 "Tx MaryEra" signedTransactionFile
H.assertEndsWithSingleNewline signedTransactionFile
H.diffFileVsGoldenFile signedTransactionFile goldenFile1

-- Sign a pool registration transaction.
-- TODO: This needs to use an unsigned tx with a registration certificate
Expand All @@ -63,8 +62,8 @@ hprop_golden_shelleyTransactionSign = propertyOnce $ H.moduleWorkspace "tmp" $ \
, "--tx-file", transactionPoolRegSignedFile
]

H.assertFileOccurences 1 "Tx MaryEra" transactionPoolRegSignedFile
H.assertEndsWithSingleNewline transactionPoolRegSignedFile
goldenFile2 <- H.note "test/cardano-cli-golden/files/golden/shelley/transaction-sign-2.json"
H.diffFileVsGoldenFile transactionPoolRegSignedFile goldenFile2

void $ execCardanoCLI
[ "transaction","sign"
Expand All @@ -74,5 +73,5 @@ hprop_golden_shelleyTransactionSign = propertyOnce $ H.moduleWorkspace "tmp" $ \
, "--tx-file", transactionPoolRegSignedFile
]

H.assertFileOccurences 1 "Tx MaryEra" transactionPoolRegSignedFile
H.assertEndsWithSingleNewline transactionPoolRegSignedFile
goldenFile3 <- H.note "test/cardano-cli-golden/files/golden/shelley/transaction-sign-3.json"
H.diffFileVsGoldenFile transactionPoolRegSignedFile goldenFile3
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx MaryEra",
"description": "Ledger Cddl Format",
"cborHex": "83a4008182582091999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c300018182581d615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c11a05f5e100021a000f4240031a0007a120a100818258208dc60533b5dfa60a530955a696323a2ef4f14e8bc95a8f84cf6c441fea42342758409f69aa4bf41acf78deaffb002c4f36157f3bad7c434a19b1ffe7e7df5f98f629e58503a762e83c1f60e54c9eb7eef9885b16c2b42ce1336914f2df9aa63b1407f6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx MaryEra",
"description": "Ledger Cddl Format",
"cborHex": "83a4008182582091999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c300018182581d615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c11a05f5e100021a000f4240031a0007a120a100838258208dc60533b5dfa60a530955a696323a2ef4f14e8bc95a8f84cf6c441fea42342758409f69aa4bf41acf78deaffb002c4f36157f3bad7c434a19b1ffe7e7df5f98f629e58503a762e83c1f60e54c9eb7eef9885b16c2b42ce1336914f2df9aa63b1407825820bd07998bca8de945482d950a3051f0e4d18afedecbc08d4c99c23f1804f3c8e5584005aa65cbc59470743670086a4a769b6ec66db7f1e587b8be962660a32d94a9d25bb38732e3cea546c9b1bfb86bc2c30b9f0c6319a0a838d06e2597836aa215098258200ef55ad974b238209f51d0eed5ffbb00220a9811c0481eaf127ceb1c525f1eb658401712b3dda8b356303ec1689062c0c829ba3ae05c125f988fd87f4a23c0bc32f6ed7e18b5b4bb882e0fa952b8c982a606e3b611ca34cca938403c69165d78bb07f6"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "Witnessed Tx MaryEra",
"description": "Ledger Cddl Format",
"cborHex": "83a4008182582091999ea21177b33ebe6b8690724a0c026d410a11ad7521caa350abdafa5394c300018182581d615dbe1e2117641f8d618034b801a870ca731ce758c3bedd5c7e4429c11a05f5e100021a000f4240031a0007a120a100818258202b35e914764560fcf7655523d303d8cf27fc8306b6e86891802feedcfa087715584045b312c96ff0f453a387c49be271ca91ddfd724b81ee4511f1d5c3bab27a6d2705b96426c9d3ad717f1ad116c7b8c3d7bebefb5453931ad7e72a4a09b9373205f6"
}

0 comments on commit eb5fa26

Please sign in to comment.