Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create separate SharedWallet integration test spec
- Loading branch information
1 parent
289af78
commit 60fd608
Showing
6 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
lib/core-integration/src/Test/Integration/Scenario/API/Shelley/SharedWallets.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE NamedFieldPuns #-} | ||
{-# LANGUAGE NumericUnderscores #-} | ||
{-# LANGUAGE OverloadedLabels #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
{-# LANGUAGE TupleSections #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeFamilies #-} | ||
|
||
module Test.Integration.Scenario.API.Shelley.SharedWallets | ||
( spec | ||
) where | ||
|
||
import Prelude | ||
|
||
import Cardano.Wallet.Api.Types | ||
( DecodeAddress, DecodeStakeAddress, EncodeAddress (..) ) | ||
import Cardano.Wallet.Primitive.AddressDerivation | ||
( PaymentAddress ) | ||
import Cardano.Wallet.Primitive.AddressDerivation.Shelley | ||
( ShelleyKey ) | ||
import Control.Monad.IO.Class | ||
( liftIO ) | ||
import Control.Monad.Trans.Resource | ||
( runResourceT ) | ||
import Test.Hspec | ||
( SpecWith, describe ) | ||
import Test.Hspec.Extra | ||
( it ) | ||
import Test.Integration.Framework.DSL | ||
( Context (..) | ||
, Headers (..) | ||
, MnemonicLength (..) | ||
, Payload (..) | ||
, expectResponseCode | ||
, fixturePassphrase | ||
, genMnemonics | ||
, json | ||
, postSharedWallet | ||
, verify | ||
) | ||
|
||
import qualified Network.HTTP.Types as HTTP | ||
|
||
spec :: forall n. | ||
( DecodeAddress n | ||
, DecodeStakeAddress n | ||
, EncodeAddress n | ||
, PaymentAddress n ShelleyKey | ||
) => SpecWith Context | ||
spec = describe "SHARED_WALLETS" $ do | ||
it "SHARED_WALLETS_CREATE_01 - Create a shared wallet" $ \ctx -> runResourceT $ do | ||
m15 <- liftIO $ genMnemonics M15 | ||
m12 <- liftIO $ genMnemonics M12 | ||
let payload = Json [json| { | ||
"name": "Shared Wallet", | ||
"mnemonic_sentence": #{m15}, | ||
"mnemonic_second_factor": #{m12}, | ||
"passphrase": #{fixturePassphrase}, | ||
"address_pool_gap": 30 | ||
} |] | ||
r <- postSharedWallet ctx Default payload | ||
verify r | ||
[ expectResponseCode HTTP.status201 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters