File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed
byron/test/integration/Test/Integration/Byron/Scenario/API Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -172,9 +172,14 @@ scenario_ADDRESS_CREATE_02 = it title $ \ctx -> do
172172 w <- emptyIcarusWallet ctx
173173 let payload = Json [json | { "passphrase": "Secure Passphrase" }|]
174174 r <- request @ (ApiAddress n ) ctx (Link. postRandomAddress w) Default payload
175- verify r [ expectResponseCode @ IO HTTP. status403 ]
175+ verify r
176+ [ expectResponseCode @ IO HTTP. status403
177+ , expectErrorMessage
178+ " I cannot derive new address for this wallet type.\
179+ \ Make sure to use Byron random wallet id."
180+ ]
176181 where
177- title = " ADDRESS_CREATE_02 - Creation if forbidden on Icarus wallets"
182+ title = " ADDRESS_CREATE_02 - Creation is forbidden on Icarus wallets"
178183
179184scenario_ADDRESS_CREATE_03
180185 :: forall (n :: NetworkDiscriminant ) t .
@@ -250,6 +255,9 @@ scenario_ADDRESS_CREATE_06 = it title $ \ctx -> do
250255 r0 <- request @ (ApiAddress n ) ctx (Link. postRandomAddress w) Default payload
251256 verify r0 [ expectResponseCode @ IO HTTP. status201 ]
252257 r1 <- request @ (ApiAddress n ) ctx (Link. postRandomAddress w) Default payload
253- verify r1 [ expectResponseCode @ IO HTTP. status409 ]
258+ verify r1
259+ [ expectResponseCode @ IO HTTP. status409
260+ , expectErrorMessage " I already know of such address."
261+ ]
254262 where
255263 title = " ADDRESS_CREATE_06 - Cannot create an address that already exists"
Original file line number Diff line number Diff line change @@ -1764,6 +1764,7 @@ data ErrCreateRandomAddress
17641764 = ErrIndexAlreadyExists (Index 'Hardened 'AddressK)
17651765 | ErrCreateAddrNoSuchWallet ErrNoSuchWallet
17661766 | ErrCreateAddrWithRootKey ErrWithRootKey
1767+ | ErrCreateAddressNotAByronWallet
17671768 deriving (Generic , Eq , Show )
17681769
17691770{- ------------------------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -702,7 +702,7 @@ byronServer byron icarus ntp =
702702 byronAddresses =
703703 (\ wid s -> withLegacyLayer wid
704704 (byron, postRandomAddress byron wid s)
705- (icarus, throwError err403 )
705+ (icarus, liftHandler $ throwE ErrCreateAddressNotAByronWallet )
706706 )
707707 :<|> (\ wid s -> withLegacyLayer wid
708708 (byron , listAddresses byron (const pure ) wid s)
@@ -2381,6 +2381,11 @@ instance LiftHandler ErrCreateRandomAddress where
23812381 [ " I cannot derive a new unused address #" , pretty (fromEnum ix)
23822382 , " because I already know of such address."
23832383 ]
2384+ ErrCreateAddressNotAByronWallet ->
2385+ apiError err403 InvalidWalletType $ mconcat
2386+ [ " I cannot derive new address for this wallet type."
2387+ , " Make sure to use Byron random wallet id."
2388+ ]
23842389
23852390instance LiftHandler (Request , ServerError ) where
23862391 handler (req, err@ (ServerError code _ body headers))
Original file line number Diff line number Diff line change @@ -629,6 +629,7 @@ data ApiErrorCode
629629 | NotImplemented
630630 | WalletNotResponding
631631 | AddressAlreadyExists
632+ | InvalidWalletType
632633 deriving (Eq , Generic , Show )
633634
634635-- | Defines a point in time that can be formatted as and parsed from an
You can’t perform that action at this time.
0 commit comments