Skip to content

Commit a1cd926

Browse files
committed
cardano-testnet: add golden file for output of query stake-address-info
1 parent 51fa20e commit a1cd926

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

cardano-testnet/test/cardano-testnet-test/Cardano/Testnet/Test/Cli/Query.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,28 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
269269
TestQueryStakeAddressInfoCmd ->
270270
-- stake-address-info
271271
do
272+
-- to stdout
272273
let delegatorKeys = Defaults.defaultDelegatorStakeKeyPair 1
273274
delegatorVKey :: VerificationKey StakeKey <- readVerificationKeyFromFile AsStakeKey work $ verificationKey delegatorKeys
274275
let stakeAddress :: StakeAddress = verificationStakeKeyToStakeAddress testnetMagic delegatorVKey
275276
H.noteM_ $ execCli' execConfig [ eraName, "query", "stake-address-info"
276277
, "--address", T.unpack $ serialiseAddress stakeAddress
277278
]
279+
-- to a file
280+
let stakeAddressInfoOutFile = work </> "stake-address-info-out.json"
281+
redactedStakeAddressInfoOutFile = work </> "stake-address-info-out-redacted.json"
282+
H.noteM_ $ execCli' execConfig [ eraName, "query", "stake-address-info"
283+
, "--address", T.unpack $ serialiseAddress stakeAddress
284+
, "--out-file", stakeAddressInfoOutFile
285+
]
286+
287+
redactJsonFieldsInFile
288+
(fromList (map (, "<redacted>") ["address", "stakeDelegation", "voteDelegation"]))
289+
stakeAddressInfoOutFile
290+
redactedStakeAddressInfoOutFile
291+
H.diffFileVsGoldenFile
292+
redactedStakeAddressInfoOutFile
293+
"test/cardano-testnet-test/files/golden/queries/stakeAddressInfoOut.json"
278294

279295
TestQueryUTxOCmd ->
280296
-- utxo
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
{
3+
"address": "<redacted>",
4+
"delegationDeposit": 0,
5+
"rewardAccountBalance": 0,
6+
"stakeDelegation": "<redacted>",
7+
"voteDelegation": "<redacted>"
8+
}
9+
]

0 commit comments

Comments
 (0)