Skip to content

Commit

Permalink
reuse TRANS_DELETE_06 for byron-wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Oct 28, 2019
1 parent 1620655 commit be6f978
Showing 1 changed file with 21 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1533,20 +1533,10 @@ spec = do
txDeleteHTTPMethodsTest "wallets"
txDeleteHTTPMethodsTest "byron-wallets"

it "TRANS_DELETE_06 -\
\ Cannot forget tx that is performed from different wallet -> 404"
$ \ctx -> do
wDifferent <- emptyWallet ctx
(wSrc, wDest) <- (,) <$> fixtureWallet ctx <*> emptyWallet ctx
rMkTx <- postTx ctx (wSrc, postTxEp) wDest (1 :: Natural)
let txId = toText $ getApiT $ getFromResponse #id rMkTx
let endpoint = "v2/wallets/"
<> wDifferent ^. walletId
<> "/transactions/"
<> txId
ra <- request @ApiTxId @IO ctx ("DELETE", endpoint) Default Empty
expectResponseCode @IO HTTP.status404 ra
expectErrorMessage (errMsg404CannotFindTx txId) ra
describe "TRANS_DELETE_06 -\
\ Cannot forget tx that is performed from different wallet" $ do
txDeleteFromDifferentWalletTest emptyWallet "wallets"
txDeleteFromDifferentWalletTest emptyByronWallet "byron-wallets"

it "BYRON_TRANS_DELETE -\
\ Cannot delete tx on Byron wallet using shelley ep" $ \ctx -> do
Expand Down Expand Up @@ -1727,6 +1717,23 @@ spec = do
expectResponseCode @IO HTTP.status404 r
expectErrorMessage errMsg404NoEndpoint r

txDeleteFromDifferentWalletTest eWallet resource=
it resource $ \ctx -> do
-- post tx
(wSrc, wDest) <- (,) <$> fixtureWallet ctx <*> emptyWallet ctx
rMkTx <- postTx ctx (wSrc, postTxEp) wDest (1 :: Natural)

-- try to forget from different wallet
wDifferent <- eWallet ctx
let txId = toText $ getApiT $ getFromResponse #id rMkTx
let endpoint = "v2/" <> T.pack resource <> "/"
<> wDifferent ^. walletId
<> "/transactions/"
<> txId
ra <- request @ApiTxId @IO ctx ("DELETE", endpoint) Default Empty
expectResponseCode @IO HTTP.status404 ra
expectErrorMessage (errMsg404CannotFindTx txId) ra

txDeleteHTTPHeadersTest eWallet resource =
describe resource $ do
forM_ (getHeaderCases HTTP.status404)
Expand Down

0 comments on commit be6f978

Please sign in to comment.