From 049bfda4cef176e3b37c7f9708c6b1a015e73d32 Mon Sep 17 00:00:00 2001 From: Ben Carman Date: Wed, 8 Jul 2020 06:22:13 -0500 Subject: [PATCH] Make getAddressInfo Tests not reliant on timestamp (#1635) --- .../rpc/v17/BitcoindV17RpcClientTest.scala | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala b/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala index c7930c9f57..16c27f5668 100644 --- a/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala +++ b/bitcoind-rpc-test/src/test/scala/org/bitcoins/rpc/v17/BitcoindV17RpcClientTest.scala @@ -107,42 +107,28 @@ class BitcoindV17RpcClientTest extends BitcoindRpcTest { } yield assert(signed.complete) } - private val SpreadInSeconds = 40 - it should "be able to get the address info for a given address" in { for { (client, _) <- clientsF addr <- client.getNewAddress - addrTime = System.currentTimeMillis() info <- client.getAddressInfo(addr) - } yield assert( - info.timestamp - .map(_.toEpochSecond) - .getOrElse(0L) === addrTime / 1000 +- SpreadInSeconds) + } yield assert(info.address == addr) } it should "be able to get the address info for a given P2SHSegwit address" in { for { (client, _) <- clientsF addr <- client.getNewAddress(addressType = AddressType.P2SHSegwit) - addrTime = System.currentTimeMillis() info <- client.getAddressInfo(addr) - } yield assert( - info.timestamp - .map(_.toEpochSecond) - .getOrElse(0L) === addrTime / 1000 +- SpreadInSeconds) + } yield assert(info.address == addr) } it should "be able to get the address info for a given Legacy address" in { for { (client, _) <- clientsF addr <- client.getNewAddress(addressType = AddressType.Legacy) - addrTime = System.currentTimeMillis() info <- client.getAddressInfo(addr) - } yield assert( - info.timestamp - .map(_.toEpochSecond) - .getOrElse(0L) === addrTime / 1000 +- SpreadInSeconds) + } yield assert(info.address == addr) } // needs #360 to be merged @@ -150,14 +136,10 @@ class BitcoindV17RpcClientTest extends BitcoindRpcTest { for { (client, _) <- clientsF addr <- client.getNewAddress(AddressType.Bech32) - addrTime = System.currentTimeMillis() info <- client.getAddressInfo(addr) } yield { assert(info.address.networkParameters == RegTest) - assert( - info.timestamp - .map(_.toEpochSecond) - .getOrElse(0L) === addrTime / 1000 +- SpreadInSeconds) + assert(info.address == addr) } }