@@ -91,6 +91,7 @@ import Test.Integration.Framework.TestData
9191 , errMsg403NotEnoughMoney_
9292 , errMsg403UTxO
9393 , errMsg403WrongPass
94+ , errMsg403WrongPass
9495 , errMsg404NoWallet
9596 )
9697
@@ -161,7 +162,7 @@ spec = do
161162 describe " BYRON_RESTORATION" $ do
162163 scenario_RESTORE_01 @ n fixtureRandomWallet
163164 scenario_RESTORE_02 @ n (fixtureRandomWalletAddrs @ n )
164- scenario_RESTORE_03 @ n
165+ scenario_RESTORE_03 @ n (fixtureRandomWalletAddrs @ n )
165166--
166167-- Scenarios
167168--
@@ -512,16 +513,22 @@ scenario_RESTORE_01 fixtureSource = it title $ \ctx -> do
512513 (`shouldBe` Quantity (faucetAmt + amnt))
513514 ]
514515
516+ -- ACTION
515517 rd1 <- request
516518 @ ApiByronWallet ctx (Link. deleteWallet @ 'Byron wDest) Default Empty
517519 expectResponseCode @ IO HTTP. status204 rd1
518520
521+ -- MORE SETUP
519522 let (Right seed) = fromMnemonic @ '[12 ] (mnemonicToText mnemonics)
520523 let rootXPrv = T. decodeUtf8 $ hex $ getKey $
521524 generateKeyFromSeed seed
522525 (Passphrase $ BA. convert $ T. encodeUtf8 fixturePassphrase)
526+
527+ -- ACTION
523528 wDestRestored <- emptyByronWalletFromXPrvWith ctx " random"
524529 (" Byron Wallet Restored" , rootXPrv, fixturePassphraseEncrypted)
530+
531+ -- ASSERTIONS
525532 eventually " destination balance increases" $ do
526533 rDest <- request @ ApiByronWallet ctx
527534 (Link. getWallet @ 'Byron wDestRestored) Default Empty
@@ -549,7 +556,6 @@ scenario_RESTORE_02 fixtureTarget = it title $ \ctx -> do
549556 (Passphrase $ BA. convert $ T. encodeUtf8 fixturePassphrase)
550557 wSrc <- emptyByronWalletFromXPrvWith ctx " random"
551558 (" Byron Wallet Restored" , rootXPrv, fixturePassphraseEncrypted)
552-
553559 (wDest, payment) <- do
554560 (wDest, addrs) <- fixtureTarget ctx
555561 pure (wDest, mkPayment @ n (head addrs) amnt)
@@ -598,25 +604,43 @@ scenario_RESTORE_03
598604 ( DecodeAddress n
599605 , EncodeAddress n
600606 )
601- => SpecWith (Context t )
602- scenario_RESTORE_03 = it title $ \ ctx -> do
607+ => (Context t -> IO (ApiByronWallet , [Address ]))
608+ -> SpecWith (Context t )
609+ scenario_RESTORE_03 fixtureTarget = it title $ \ ctx -> do
603610 -- SETUP
604611 mnemonics <- mnemonicToText <$> nextWallet @ " random" (_faucet ctx)
605612 let (Right seed) = fromMnemonic @ '[12 ] mnemonics
606613 let rootXPrv = T. decodeUtf8 $ hex $ getKey $
607614 generateKeyFromSeed seed
608615 (Passphrase $ BA. convert $ T. encodeUtf8 fixturePassphrase)
609616 let passHashCorrupted = T. replicate 100 " 0"
617+ let amnt = 100_000 :: Natural
618+ (_, payment) <- do
619+ (wDest, addrs) <- fixtureTarget ctx
620+ pure (wDest, mkPayment @ n (head addrs) amnt)
621+
622+ -- ACTION
610623 wSrc <- emptyByronWalletFromXPrvWith ctx " random"
611624 (" Byron Wallet Restored" , rootXPrv, passHashCorrupted)
612625 rSrc <- request @ ApiByronWallet ctx
613626 (Link. getWallet @ 'Byron wSrc) Default Empty
627+ -- ASSERTIONS
614628 verify rSrc
615629 [ expectField (# balance . # available)
616630 (`shouldBe` Quantity faucetAmt)
617631 ]
632+
633+ -- ACTION
634+ r <- postByronTransaction @ n ctx wSrc [payment] fixturePassphrase
635+ -- ASSERTIONS
636+ verify r
637+ [ expectResponseCode HTTP. status403
638+ , expectErrorMessage errMsg403WrongPass
639+ ]
640+
618641 where
619- title = " BYRON_RESTORE_03 - restoring wallet from corrupted hash gives proper balance"
642+ title = " BYRON_RESTORE_03 - restoring wallet from corrupted hash gives\
643+ \ proper balance but sending tx fails"
620644
621645
622646--
0 commit comments