Skip to content

Commit c8e89ed

Browse files
committed
cleaning integration tests
1 parent 04b74e0 commit c8e89ed

File tree

3 files changed

+14
-44
lines changed

3 files changed

+14
-44
lines changed

lib/byron/test/integration/Test/Integration/Byron/Scenario/API/Transactions.hs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import Test.Integration.Framework.DSL
6969
, fixtureIcarusWalletAddrs
7070
, fixtureIcarusWalletWith
7171
, fixturePassphrase
72+
, fixturePassphraseEncrypted
7273
, fixtureRandomWallet
7374
, fixtureRandomWalletAddrs
7475
, fixtureRandomWalletMws
@@ -515,14 +516,8 @@ scenario_RESTORE_01 fixtureSource = it title $ \ctx -> do
515516
let rootXPrv = T.decodeUtf8 $ hex $ getKey $
516517
generateKeyFromSeed seed
517518
(Passphrase $ BA.convert $ T.encodeUtf8 fixturePassphrase)
518-
let passwHash =
519-
"31347c387c317c2b6a6f747446495a6a566d586f43374c6c54425a576c\
520-
\597a425834515177666475467578436b4d485569733d7c78324d646738\
521-
\49554a3232507235676531393575445a76583646552b7757395a6a6a2f\
522-
\51303054356c654751794279732f7662753367526d726c316c657a7150\
523-
\43676d364e6758476d4d2f4b6438343265304b4945773d3d"
524519
wDestRestored <- emptyByronWalletFromXPrvWith ctx "random"
525-
("Byron Wallet Restored", rootXPrv, passwHash)
520+
("Byron Wallet Restored", rootXPrv, fixturePassphraseEncrypted)
526521
eventually "destination balance increases" $ do
527522
rDest <- request @ApiByronWallet ctx
528523
(Link.getWallet @'Byron wDestRestored) Default Empty

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ module Test.Integration.Framework.DSL
8787
, eventually
8888
, eventuallyUsingDelay
8989
, fixturePassphrase
90+
, fixturePassphraseEncrypted
9091
, waitForNextEpoch
9192
, waitAllTxsInLedger
9293
, toQueryString
@@ -658,11 +659,19 @@ fixtureRawTx ctx (addr, amt) =
658659
BL.fromStrict <$> build (addr, Coin $ fromIntegral amt)
659660

660661
-- | Default passphrase used for fixture wallets
661-
fixturePassphrase
662-
:: Text
662+
fixturePassphrase :: Text
663663
fixturePassphrase =
664664
"cardano-wallet"
665665

666+
-- | fixturePassphrase encrypted by Scrypt function
667+
fixturePassphraseEncrypted :: Text
668+
fixturePassphraseEncrypted =
669+
"31347c387c317c2b6a6f747446495a6a566d586f43374c6c54425a576c\
670+
\597a425834515177666475467578436b4d485569733d7c78324d646738\
671+
\49554a3232507235676531393575445a76583646552b7757395a6a6a2f\
672+
\51303054356c654751794279732f7662753367526d726c316c657a7150\
673+
\43676d364e6758476d4d2f4b6438343265304b4945773d3d"
674+
666675
-- | Restore a faucet and wait until funds are available.
667676
fixtureWallet
668677
:: Context t

lib/core-integration/src/Test/Integration/Scenario/API/ByronWallets.hs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@ import Cardano.Wallet.Api.Types
2222
, WalletStyle (..)
2323
)
2424
import Cardano.Wallet.Primitive.AddressDerivation
25-
( FromMnemonic (..)
26-
, Passphrase (..)
27-
, PassphraseMaxLength (..)
28-
, PassphraseMinLength (..)
29-
, hex
30-
)
31-
import Cardano.Wallet.Primitive.AddressDerivation.Byron
32-
( ByronKey (..), generateKeyFromSeed )
25+
( PassphraseMaxLength (..), PassphraseMinLength (..) )
3326
import Cardano.Wallet.Primitive.Mnemonic
3427
( ConsistentEntropy
3528
, EntropySize
@@ -60,7 +53,6 @@ import Test.Integration.Framework.DSL
6053
( Context (..)
6154
, Headers (..)
6255
, Payload (..)
63-
, emptyByronWalletFromXPrvWith
6456
, emptyByronWalletWith
6557
, emptyIcarusWallet
6658
, emptyRandomWallet
@@ -95,9 +87,7 @@ import Test.Integration.Framework.TestData
9587
)
9688

9789
import qualified Cardano.Wallet.Api.Link as Link
98-
import qualified Data.ByteArray as BA
9990
import qualified Data.Text as T
100-
import qualified Data.Text.Encoding as T
10191
import qualified Network.HTTP.Types.Status as HTTP
10292

10393
spec :: forall n t.
@@ -409,30 +399,6 @@ spec = do
409399
[ expectResponseCode @IO HTTP.status201
410400
, expectField (#balance . #available) (`shouldBe` Quantity faucetAmt)
411401
]
412-
413-
it "BYRON_RESTORE_10 - Can restore wallet using master root key" $ \ctx -> do
414-
m <- genMnemonics @12
415-
let passw = "Secure Passphrase"
416-
w1 <- emptyByronWalletWith ctx "random"
417-
("Byron Wallet", m, passw)
418-
rd1 <- request
419-
@ApiByronWallet ctx (Link.deleteWallet @'Byron w1) Default Empty
420-
expectResponseCode @IO HTTP.status204 rd1
421-
422-
let (Right seed) = fromMnemonic @'[12] m
423-
let rootXPrv = T.decodeUtf8 $ hex $ getKey $
424-
generateKeyFromSeed seed (Passphrase $ BA.convert $ T.encodeUtf8 passw)
425-
let passwHash =
426-
"31347c387c317c714968506842665966555a336f5156434c384449744b\
427-
\677642417a6c584d62314d6d4267695433776a556f3d7c53672b436e30\
428-
\4232766b4475682f704265335569694577633364385845756f55737661\
429-
\42514e62464443353569474f4135736e453144326743346f47564c472b\
430-
\524331385958326c6863552f36687a38432f496172773d3d"
431-
w2 <- emptyByronWalletFromXPrvWith ctx "random"
432-
("Byron Wallet", rootXPrv, passwHash)
433-
rd2 <- request
434-
@ApiByronWallet ctx (Link.deleteWallet @'Byron w2) Default Empty
435-
expectResponseCode @IO HTTP.status204 rd2
436402
where
437403
genMnemonics
438404
:: forall mw ent csz.

0 commit comments

Comments
 (0)