Skip to content

Commit

Permalink
Resurrect test MIGRATE_03.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed May 13, 2021
1 parent 379e3a3 commit 5f9ea4b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
Expand Up @@ -350,6 +350,27 @@ spec = describe "BYRON_MIGRATIONS" $ do
((`shouldBe` (Just 2)) . Map.lookup 1_000_000_000_000)
]

it "BYRON_MIGRATE_03 - \
\Migrating an empty wallet should fail."
$ \ctx -> forM_ [emptyRandomWallet, emptyIcarusWallet]
$ \emptyByronWallet -> runResourceT $ do
sourceWallet <- emptyByronWallet ctx
let sourceWalletId = sourceWallet ^. walletId
targetWallet <- emptyWallet ctx
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.migrateWallet @'Byron sourceWallet
response <- request @[ApiTransaction n] ctx ep Default $
Json [json|
{ passphrase: #{fixturePassphrase}
, addresses: #{targetAddressIds}
}|]
verify response
[ expectResponseCode HTTP.status403
, expectErrorMessage (errMsg403NothingToMigrate sourceWalletId)
]

describe "BYRON_MIGRATE_05 - I could migrate to any valid address" $ do
forM_ [ ("Byron", emptyRandomWallet)
, ("Icarus", emptyIcarusWallet)
Expand Down Expand Up @@ -426,28 +447,6 @@ spec = describe "BYRON_MIGRATIONS" $ do
, expectField (#balance . #available) (`shouldBe` Quantity 0)
]

it "BYRON_MIGRATE_XX - \
\migrating an empty wallet should fail."
$ \ctx -> forM_ [emptyRandomWallet, emptyIcarusWallet]
$ \emptyByronWallet -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
sourceWallet <- emptyByronWallet ctx
targetWallet <- emptyWallet ctx
addrs <- listAddresses @n ctx targetWallet
let addr1 = (addrs !! 1) ^. #id
let payload =
Json [json|
{ passphrase: #{fixturePassphrase}
, addresses: [#{addr1}]
}|]
let ep = Link.migrateWallet @'Byron sourceWallet
r <- request @[ApiTransaction n] ctx ep Default payload
let srcId = sourceWallet ^. walletId
verify r
[ expectResponseCode HTTP.status403
, expectErrorMessage (errMsg403NothingToMigrate srcId)
]

Hspec.it "BYRON_MIGRATE_XX - \
\migrating wallet with dust should fail."
$ \ctx -> runResourceT @IO $ do
Expand Down Expand Up @@ -491,7 +490,7 @@ spec = describe "BYRON_MIGRATIONS" $ do
, expectErrorMessage (errMsg403NothingToMigrate srcId)
]

it "BYRON_MIGRATE_03 - \
it "BYRON_MIGRATE_XX - \
\actual fee for migration is the same as the predicted fee."
$ \ctx -> forM_ [fixtureRandomWallet, fixtureIcarusWallet]
$ \fixtureByronWallet -> runResourceT $ do
Expand Down
Expand Up @@ -333,25 +333,24 @@ spec = describe "SHELLEY_MIGRATIONS" $ do
((`shouldBe` (Just 2)) . Map.lookup 10_000_000_000_000)
]

it "SHELLEY_MIGRATE_XX - \
\migrating an empty wallet should fail."
it "SHELLEY_MIGRATE_03 - \
\Migrating an empty wallet should fail."
$ \ctx -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
sourceWallet <- emptyWallet ctx
let sourceWalletId = sourceWallet ^. walletId
targetWallet <- emptyWallet ctx
addrs <- listAddresses @n ctx targetWallet
let addr1 = (addrs !! 1) ^. #id
let payload =
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.migrateWallet @'Shelley sourceWallet
response <- request @[ApiTransaction n] ctx ep Default $
Json [json|
{ passphrase: #{fixturePassphrase}
, addresses: [#{addr1}]
, addresses: #{targetAddressIds}
}|]
let ep = Link.migrateWallet @'Shelley sourceWallet
r <- request @[ApiTransaction n] ctx ep Default payload
let srcId = sourceWallet ^. walletId
verify r
verify response
[ expectResponseCode HTTP.status403
, expectErrorMessage (errMsg403NothingToMigrate srcId)
, expectErrorMessage (errMsg403NothingToMigrate sourceWalletId)
]

Hspec.it "SHELLEY_MIGRATE_XX - \
Expand Down Expand Up @@ -419,7 +418,7 @@ spec = describe "SHELLEY_MIGRATIONS" $ do
( `shouldBe` Quantity expectedBalance)
]

it "SHELLEY_MIGRATE_03 - \
it "SHELLEY_MIGRATE_xx - \
\actual fee for migration is the same as the predicted fee."
$ \ctx -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
Expand Down

0 comments on commit 5f9ea4b

Please sign in to comment.