Skip to content

Commit

Permalink
Merge pull request #451 from input-output-hk/smelc/fix-assert-file-oc…
Browse files Browse the repository at this point in the history
…curences-6

Replace usages of assertFileOccurences (6/6)
  • Loading branch information
smelc authored Nov 13, 2023
2 parents 4478e12 + 76893fc commit 02d1f4b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module Test.Golden.Shelley.Node.KeyGen

import Control.Monad (void)

import Test.Cardano.CLI.Aeson
import Test.Cardano.CLI.Util

import Hedgehog (Property)
Expand All @@ -26,9 +27,9 @@ hprop_golden_shelleyNodeKeyGen = propertyOnce . H.moduleWorkspace "tmp" $ \tempD
, "--operational-certificate-issue-counter", opCertCounterFile
]

H.assertFileOccurences 1 "StakePoolVerificationKey_ed25519" verificationKeyFile
H.assertFileOccurences 1 "StakePoolSigningKey_ed25519" signingKeyFile
H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" opCertCounterFile
assertHasMappings [("type", "StakePoolVerificationKey_ed25519"), ("description", "Stake Pool Operator Verification Key")] verificationKeyFile
assertHasMappings [("type", "StakePoolSigningKey_ed25519"), ("description", "Stake Pool Operator Signing Key")] signingKeyFile
assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 0")] opCertCounterFile

H.assertEndsWithSingleNewline verificationKeyFile
H.assertEndsWithSingleNewline signingKeyFile
Expand All @@ -47,9 +48,9 @@ hprop_golden_shelleyNodeKeyGen_te = propertyOnce . H.moduleWorkspace "tmp" $ \te
, "--operational-certificate-issue-counter", opCertCounterFile
]

H.assertFileOccurences 1 "StakePoolVerificationKey_ed25519" verificationKeyFile
H.assertFileOccurences 1 "StakePoolSigningKey_ed25519" signingKeyFile
H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" opCertCounterFile
assertHasMappings [("type", "StakePoolVerificationKey_ed25519"), ("description", "Stake Pool Operator Verification Key")] verificationKeyFile
assertHasMappings [("type", "StakePoolSigningKey_ed25519"), ("description", "Stake Pool Operator Signing Key")] signingKeyFile
assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 0")] opCertCounterFile

H.assertEndsWithSingleNewline verificationKeyFile
H.assertEndsWithSingleNewline signingKeyFile
Expand All @@ -71,6 +72,6 @@ hprop_golden_shelleyNodeKeyGen_bech32 = propertyOnce . H.moduleWorkspace "tmp" $

H.assertFileOccurences 1 "pool_vk" verificationKeyFile
H.assertFileOccurences 1 "pool_sk" signingKeyFile
H.assertFileOccurences 1 "NodeOperationalCertificateIssueCounter" opCertCounterFile
assertHasMappings [("type", "NodeOperationalCertificateIssueCounter"), ("description", "Next certificate issue number: 0")] opCertCounterFile

H.assertEndsWithSingleNewline opCertCounterFile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module Test.Golden.Shelley.Node.KeyGenKes where

import Control.Monad (void)

import Test.Cardano.CLI.Aeson
import Test.Cardano.CLI.Util

import Hedgehog (Property)
Expand All @@ -23,8 +24,8 @@ hprop_golden_shelleyNodeKeyGenKes = propertyOnce . H.moduleWorkspace "tmp" $ \te
, "--signing-key-file", signingKey
]

H.assertFileOccurences 1 "KesVerificationKey_ed25519_kes_2^6" verificationKey
H.assertFileOccurences 1 "KesSigningKey_ed25519_kes_2^6" signingKey
assertHasMappings [("type", "KesVerificationKey_ed25519_kes_2^6"), ("description", "KES Verification Key")] verificationKey
assertHasMappings [("type", "KesSigningKey_ed25519_kes_2^6"), ("description", "KES Signing Key")] signingKey

H.assertEndsWithSingleNewline verificationKey
H.assertEndsWithSingleNewline signingKey
Expand All @@ -41,8 +42,8 @@ hprop_golden_shelleyNodeKeyGenKes_te = propertyOnce . H.moduleWorkspace "tmp" $
, "--signing-key-file", signingKey
]

H.assertFileOccurences 1 "KesVerificationKey_ed25519_kes_2^6" verificationKey
H.assertFileOccurences 1 "KesSigningKey_ed25519_kes_2^6" signingKey
assertHasMappings [("type", "KesVerificationKey_ed25519_kes_2^6"), ("description", "KES Verification Key")] verificationKey
assertHasMappings [("type", "KesSigningKey_ed25519_kes_2^6"), ("description", "KES Signing Key")] signingKey

H.assertEndsWithSingleNewline verificationKey
H.assertEndsWithSingleNewline signingKey
Expand Down

0 comments on commit 02d1f4b

Please sign in to comment.