-
Notifications
You must be signed in to change notification settings - Fork 721
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit test for deprecated tx body format
- Loading branch information
Showing
7 changed files
with
74 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE TemplateHaskell #-} | ||
|
||
module Test.Cli.CliIntermediateFormat | ||
( tests | ||
) where | ||
|
||
import Cardano.Prelude | ||
import Hedgehog (Property, discover) | ||
import Test.OptParse | ||
|
||
import qualified Hedgehog | ||
import qualified Hedgehog.Extras.Test.Base as H | ||
import qualified Hedgehog.Extras.Test.File as H | ||
|
||
{- HLINT ignore "Use camelCase" -} | ||
|
||
-- | We test to make sure that we can deserialize a tx body in the intermediate format | ||
prop_backwardsCompatibleCliFormat :: Property | ||
prop_backwardsCompatibleCliFormat = propertyOnce $ H.moduleWorkspace "tmp" $ \tempDir -> do | ||
txBodyFile <- noteInputFile "test/data/golden/babbage/deprecated-cli-format.body" | ||
witness <- noteInputFile "test/data/golden/babbage/tx-key-witness" | ||
initialUtxo1SigningKeyFile <- noteInputFile "test/data/golden/shelley/keys/payment_keys/signing_key" | ||
signedTransactionFile <- noteTempFile tempDir "signed.tx" | ||
|
||
|
||
void $ execCardanoCLI | ||
[ "transaction","sign" | ||
, "--mainnet" | ||
, "--tx-body-file", txBodyFile | ||
, "--signing-key-file", initialUtxo1SigningKeyFile | ||
, "--tx-file", signedTransactionFile | ||
] | ||
|
||
H.assertFileOccurences 1 "Tx BabbageEra" signedTransactionFile | ||
H.assertEndsWithSingleNewline signedTransactionFile | ||
|
||
void $ execCardanoCLI | ||
[ "transaction","assemble" | ||
, "--tx-body-file", txBodyFile | ||
, "--witness-file", witness | ||
, "--out-file", signedTransactionFile | ||
] | ||
|
||
H.assertFileOccurences 1 "Tx BabbageEra" signedTransactionFile | ||
H.assertEndsWithSingleNewline signedTransactionFile | ||
|
||
-- ----------------------------------------------------------------------------- | ||
|
||
tests :: IO Bool | ||
tests = | ||
Hedgehog.checkParallel $$discover | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
cardano-cli/test/data/golden/babbage/deprecated-cli-format.body
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "TxBodyBabbage", | ||
"description": "", | ||
"cborHex": "86a3008182582097c7a4b969dbab432c66ac034c023fb5861b73d198d700b55b9818b9bb1c2dba000182a200581d604088059bbeb6add02eecd0c6a2a52c06910f2a6b4ba0029e9fe6ed13011a00989680a20058390076619da7963eaa588252c45e960667a4647eed69135f51f5a10f2888d2c20ac07056fc8899c47d825cefd9dcf5efba150236e043262e2b43011b0000011764f7bd57021a00028c299fff8080f5f6" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"type": "TxWitness BabbageEra", | ||
"description": "", | ||
"cborHex": "8200825820de40a0376a4953d0fd0ea543c0f5317269a40258f2986153f6304494b430eaab58403d6fcac7d92c75d564b88415c0df07e6442db08049abfeb11b58d1084db82a3480fdb6aa4cb34564b0dd2abb7e7e7d3acd954d0a2b9145939c80e967e0d5cb07" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters