Skip to content

Commit

Permalink
Resurrect test CREATE_MIGRATION_PLAN_03.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed May 13, 2021
1 parent c2e3657 commit b231185
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 25 deletions.
Expand Up @@ -160,6 +160,23 @@ spec = describe "BYRON_MIGRATIONS" $ do
(errMsg403NothingToMigrate $ sourceWallet ^. walletId)
]

it "BYRON_CREATE_MIGRATION_PLAN_03 - \
\Cannot create plan for Shelley wallet using Byron endpoint."
$ \ctx -> runResourceT $ do
sourceWallet <- emptyWallet ctx
targetWallet <- emptyWallet ctx
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.createMigrationPlan @'Byron sourceWallet
response <- request @(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
verify response
[ expectResponseCode HTTP.status404
, expectErrorMessage
(errMsg404NoWallet $ sourceWallet ^. walletId)
]

it "BYRON_CALCULATE_02 - \
\Cannot calculate fee for wallet with dust, that cannot be migrated."
$ \ctx -> runResourceT $ do
Expand All @@ -184,16 +201,6 @@ spec = describe "BYRON_MIGRATIONS" $ do
, expectErrorMessage (errMsg403NothingToMigrate $ w ^. walletId)
]

it "BYRON_CALCULATE_03 - \
\Cannot estimate migration for Shelley wallet using Byron endpoint"
$ \ctx -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
w <- emptyWallet ctx
let ep = Link.createMigrationPlan @'Byron w
r <- request @(ApiWalletMigrationPlan n) ctx ep Default Empty
expectResponseCode HTTP.status404 r
expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r

describe "BYRON_MIGRATE_05 - I could migrate to any valid address" $ do
forM_ [ ("Byron", emptyRandomWallet)
, ("Icarus", emptyIcarusWallet)
Expand Down
Expand Up @@ -157,21 +157,32 @@ spec = describe "SHELLEY_MIGRATIONS" $ do
(errMsg403NothingToMigrate $ sourceWallet ^. walletId)
]

describe "SHELLEY_CALCULATE_03 - \
\Cannot estimate migration for Byron wallet using Shelley endpoint" $ do
forM_ [ ("Byron", emptyRandomWallet)
, ("Icarus", emptyIcarusWallet)
] $ \(walType, byronWallet) -> do

it ("Cannot calculate Shelley migration using wallet: " ++ walType)
$ \ctx -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
w <- byronWallet ctx
let ep = Link.createMigrationPlan @'Shelley w
r <- request
@(ApiWalletMigrationPlan n) ctx ep Default Empty
expectResponseCode HTTP.status404 r
expectErrorMessage (errMsg404NoWallet $ w ^. walletId) r
describe "SHELLEY_CREATE_MIGRATION_PLAN_03 - \
\Cannot create plan for Byron wallet using Shelley endpoint." $ do
let sourceWallets =
[ ("Random", emptyRandomWallet)
, ("Icarus", emptyIcarusWallet)
]
forM_ sourceWallets $ \(walletType, byronWallet) -> do
let title = mconcat
[ "Cannot calculate Shelley migration using wallet: "
, walletType
]
it title $ \ctx -> runResourceT $ do
sourceWallet <- byronWallet ctx
targetWallet <- emptyWallet ctx
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.createMigrationPlan @'Shelley sourceWallet
result <- request
@(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
verify result
[ expectResponseCode HTTP.status404
, expectErrorMessage
(errMsg404NoWallet $ sourceWallet ^. walletId)
]

describe "SHELLEY_MIGRATE_01 - \
\after a migration operation successfully completes, the correct \
Expand Down

0 comments on commit b231185

Please sign in to comment.