Skip to content

Commit

Permalink
Merge pull request #865 from wavesplatform/NODE-561
Browse files Browse the repository at this point in the history
Rewrite BurnTransactionSuite in sync way for NODE-561
  • Loading branch information
ismagin authored Feb 21, 2018
2 parents 125a9a9 + b2627d9 commit 0415b08
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions it/src/main/scala/com/wavesplatform/it/api/SyncHttpApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ object SyncHttpApi extends Assertions{
def assertAssetBalance(acc: String, assetIdString: String, balance: Long): Unit =
Await.result(async(n).assertAssetBalance(acc, assetIdString, balance), RequestAwaitTime)

def assetBalance(address: String, asset: String): AssetBalance =
Await.result(async(n).assetBalance(address, asset), RequestAwaitTime)

def assetsBalance(address: String): FullAssetsInfo =
Await.result(async(n).assetsBalance(address), RequestAwaitTime)

def issue(sourceAddress: String, name: String, description: String, quantity: Long, decimals: Byte, reissuable: Boolean, fee: Long): Transaction =
Await.result(async(n).issue(sourceAddress, name, description, quantity, decimals, reissuable, fee), RequestAwaitTime)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ class BurnTransactionSuite2 extends BaseTransactionSuite {
notMiner.assertBalances(firstAddress, balance - defaultFee, effectiveBalance - defaultFee)
notMiner.assertAssetBalance(firstAddress, issuedAssetId, defaultQuantity)

// burn half of the coins and check balance
val burnId = sender.burn(firstAddress, issuedAssetId, defaultQuantity / 2, fee = defaultFee).id

nodes.waitForHeightAraiseAndTxPresent(burnId)
notMiner.assertBalances(firstAddress, balance - 2 * defaultFee, effectiveBalance - 2 * defaultFee)
notMiner.assertAssetBalance(firstAddress, issuedAssetId, defaultQuantity / 2)

val assetOpt = notMiner.assetsBalance(firstAddress).balances.find(_.assetId == issuedAssetId)
assert(assetOpt.exists(_.balance == defaultQuantity / 2))

// burn the rest and check again
val burnIdRest = sender.burn(firstAddress, issuedAssetId, defaultQuantity / 2, fee = defaultFee).id

nodes.waitForHeightAraiseAndTxPresent(burnIdRest)
notMiner.assertAssetBalance(firstAddress, issuedAssetId, 0)

val assetOptRest = notMiner.assetsBalance(firstAddress).balances.find(_.assetId == issuedAssetId)
assert(assetOptRest.isEmpty)
}
}

0 comments on commit 0415b08

Please sign in to comment.