Skip to content

Commit 3deb06f

Browse files
committed
add DSL helper in integration tests
1 parent 02818e1 commit 3deb06f

File tree

1 file changed

+19
-0
lines changed
  • lib/core-integration/src/Test/Integration/Framework

1 file changed

+19
-0
lines changed

lib/core-integration/src/Test/Integration/Framework/DSL.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ module Test.Integration.Framework.DSL
5454
, emptyByronWalletWith
5555
, emptyWallet
5656
, emptyWalletWith
57+
, emptyByronWalletFromXPrvWith
5758
, getFromResponse
5859
, getFromResponseList
5960
, json
@@ -601,6 +602,24 @@ emptyByronWalletWith ctx style (name, mnemonic, pass) = do
601602
expectResponseCode @IO HTTP.status201 r
602603
return (getFromResponse id r)
603604

605+
emptyByronWalletFromXPrvWith
606+
:: forall t. ()
607+
=> Context t
608+
-> String
609+
-> (Text, Text, Text)
610+
-> IO ApiByronWallet
611+
emptyByronWalletFromXPrvWith ctx style (name, key, passHash) = do
612+
let payload = Json [aesonQQ| {
613+
"name": #{name},
614+
"encrypted_root_private_key": #{key},
615+
"passphrase_hash": #{passHash},
616+
"style": #{style}
617+
}|]
618+
r <- request @ApiByronWallet ctx
619+
(Link.postWallet @'Byron) Default payload
620+
expectResponseCode @IO HTTP.status201 r
621+
return (getFromResponse id r)
622+
604623
-- | Create an empty wallet
605624
emptyWallet :: Context t -> IO ApiWallet
606625
emptyWallet ctx = do

0 commit comments

Comments
 (0)