Skip to content

Commit

Permalink
Resurrect test CREATE_MIGRATION_PLAN_02.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed May 13, 2021
1 parent 42c9061 commit 5d5605e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
Expand Up @@ -353,10 +353,8 @@ errMsg400MinWithdrawalWrong = "The minimum withdrawal value must be at least \
\1 Lovelace."

errMsg403NothingToMigrate :: Text -> String
errMsg403NothingToMigrate wid =
"I can't migrate the wallet with the given id: " ++ unpack wid ++
", because it's either empty or full of small coins which wouldn't be \
\worth migrating."
errMsg403NothingToMigrate _wid =
"Nothing to migrate"

errMsg404NoAsset :: String
errMsg404NoAsset = "The requested asset is not associated with this wallet."
Expand Down
Expand Up @@ -142,17 +142,22 @@ spec = describe "BYRON_MIGRATIONS" $ do
(`shouldBe` 0)
]

it "BYRON_CALCULATE_02 - \
\Cannot calculate fee for empty wallet."
it "BYRON_CREATE_MIGRATION_PLAN_02 - \
\Cannot create plan for empty wallet."
$ \ctx -> forM_ [emptyRandomWallet, emptyIcarusWallet]
$ \emptyByronWallet -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
w <- emptyByronWallet ctx
let ep = Link.createMigrationPlan @'Byron w
r <- request @(ApiWalletMigrationPlan n) ctx ep Default Empty
verify r
sourceWallet <- emptyByronWallet 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.status403
, expectErrorMessage (errMsg403NothingToMigrate $ w ^. walletId)
, expectErrorMessage
(errMsg403NothingToMigrate $ sourceWallet ^. walletId)
]

it "BYRON_CALCULATE_02 - \
Expand Down
Expand Up @@ -140,16 +140,21 @@ spec = describe "SHELLEY_MIGRATIONS" $ do
(`shouldBe` 0)
]

it "SHELLEY_CALCULATE_02 - \
\Cannot calculate fee for empty wallet."
it "SHELLEY_CREATE_MIGRATION_PLAN_02 - \
\Cannot create plan for empty wallet."
$ \ctx -> runResourceT $ do
liftIO $ pendingWith "Migration endpoints temporarily disabled."
w <- emptyWallet ctx
let ep = Link.createMigrationPlan @'Shelley w
r <- request @(ApiWalletMigrationPlan n) ctx ep Default Empty
verify r
sourceWallet <- emptyWallet ctx
targetWallet <- emptyWallet ctx
targetAddresses <- listAddresses @n ctx targetWallet
let targetAddressIds = targetAddresses <&>
(\(ApiTypes.ApiAddress addrId _ _) -> addrId)
let ep = Link.createMigrationPlan @'Shelley sourceWallet
response <- request @(ApiWalletMigrationPlan n) ctx ep Default
(Json [json|{addresses: #{targetAddressIds}}|])
verify response
[ expectResponseCode HTTP.status403
, expectErrorMessage (errMsg403NothingToMigrate $ w ^. walletId)
, expectErrorMessage
(errMsg403NothingToMigrate $ sourceWallet ^. walletId)
]

describe "SHELLEY_CALCULATE_03 - \
Expand Down

0 comments on commit 5d5605e

Please sign in to comment.