Skip to content

Commit

Permalink
Add CLI golden test for generating extended payment keys
Browse files Browse the repository at this point in the history
  • Loading branch information
intricate authored and newhoggy committed Mar 17, 2023
1 parent 2008bdc commit 0fb8085
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
5 changes: 0 additions & 5 deletions cardano-cli/cardano-cli.cabal
Expand Up @@ -279,14 +279,9 @@ test-suite cardano-cli-golden
Test.Golden.Shelley.TextEnvelope.Certificates.OperationalCertificate
Test.Golden.Shelley.TextEnvelope.Certificates.StakeAddressCertificates
Test.Golden.Shelley.TextEnvelope.Certificates.StakePoolCertificates
Test.Golden.Shelley.TextEnvelope.Keys.ExtendedPaymentKeys
Test.Golden.Shelley.TextEnvelope.Keys.GenesisDelegateKeys
Test.Golden.Shelley.TextEnvelope.Keys.GenesisKeys
Test.Golden.Shelley.TextEnvelope.Keys.GenesisUTxOKeys
Test.Golden.Shelley.TextEnvelope.Keys.KESKeys
Test.Golden.Shelley.TextEnvelope.Keys.PaymentKeys
Test.Golden.Shelley.TextEnvelope.Keys.StakeKeys
Test.Golden.Shelley.TextEnvelope.Keys.VRFKeys
Test.Golden.Shelley.TextEnvelope.Tx.Tx
Test.Golden.Shelley.TextEnvelope.Tx.TxBody
Test.Golden.Shelley.TextEnvelope.Tx.Witness
Expand Down
4 changes: 3 additions & 1 deletion cardano-cli/test/Test/Golden/Shelley.hs
Expand Up @@ -11,7 +11,8 @@ module Test.Golden.Shelley

import Test.Golden.Shelley.Address.Build (golden_shelleyAddressBuild)
import Test.Golden.Shelley.Address.Info (golden_shelleyAddressInfo)
import Test.Golden.Shelley.Address.KeyGen (golden_shelleyAddressKeyGen)
import Test.Golden.Shelley.Address.KeyGen (golden_shelleyAddressExtendedKeyGen,
golden_shelleyAddressKeyGen)
import Test.Golden.Shelley.Genesis.Create (golden_shelleyGenesisCreate)
import Test.Golden.Shelley.Genesis.InitialTxIn (golden_shelleyGenesisInitialTxIn)
import Test.Golden.Shelley.Genesis.KeyGenDelegate (golden_shelleyGenesisKeyGenDelegate)
Expand Down Expand Up @@ -90,6 +91,7 @@ keyTests =
$ H.Group "TextEnvelope Key Goldens"
[ ("golden_shelleyAddressInfo", golden_shelleyAddressInfo)
, ("golden_shelleyAddressKeyGen", golden_shelleyAddressKeyGen)
, ("golden_shelleyAddressExtendedKeyGen", golden_shelleyAddressExtendedKeyGen)
, ("golden_shelleyAddressBuild", golden_shelleyAddressBuild)
-- TODO intricate DELETE
, ("golden_shelleyExtendedPaymentKeys", golden_shelleyExtendedPaymentKeys)
Expand Down
19 changes: 19 additions & 0 deletions cardano-cli/test/Test/Golden/Shelley/Address/KeyGen.hs
Expand Up @@ -2,6 +2,7 @@

module Test.Golden.Shelley.Address.KeyGen
( golden_shelleyAddressKeyGen
, golden_shelleyAddressExtendedKeyGen
) where

import Control.Monad (void)
Expand Down Expand Up @@ -29,3 +30,21 @@ golden_shelleyAddressKeyGen = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir

H.assertFileOccurences 1 "addr_vk" addressVKeyFile
H.assertFileOccurences 1 "addr_sk" addressSKeyFile

golden_shelleyAddressExtendedKeyGen :: Property
golden_shelleyAddressExtendedKeyGen = propertyOnce . H.moduleWorkspace "tmp" $ \tempDir -> do
addressVKeyFile <- noteTempFile tempDir "address.vkey"
addressSKeyFile <- noteTempFile tempDir "address.skey"

void $ execCardanoCLI
[ "shelley","address","key-gen"
, "--extended-key"
, "--verification-key-file", addressVKeyFile
, "--signing-key-file", addressSKeyFile
]

void $ H.readFile addressVKeyFile
void $ H.readFile addressSKeyFile

H.assertFileOccurences 1 "addr_xvk" addressVKeyFile
H.assertFileOccurences 1 "addr_xsk" addressSKeyFile

0 comments on commit 0fb8085

Please sign in to comment.