def test_bid_is_published_on_topic(self): time.sleep(3) #infochan node subscribers may be not registered in master self.infochan_Bid_subscriber_topic.publish(testMessages.getValidBid()) timeout_t = time.time() + 60.0 while not rospy.is_shutdown() and not self._infochan_published_bid_success and time.time() < timeout_t: time.sleep(0.1) self.assert_(self._infochan_published_bid_success)
def test_sign_bid(self): rospy.Subscriber('/liability/infochan/eth/sending/offer', Offer, self.signed_bid_handler) bidPublisherTest = rospy.Publisher( '/liability/infochan/eth/signing/offer', Offer, queue_size=10) time.sleep( 3 ) #because signer node subscribers may be not registered in master bidPublisherTest.publish(testMessages.getValidBid()) timeout_t = time.time() + 60.0 while not rospy.is_shutdown( ) and not self._test_sign_bid_success and time.time() < timeout_t: time.sleep(0.1) self.assert_(self._test_sign_bid_success)
def infochan_published_bid_handler(self, bid): self.assertEqual(testMessages.getValidBid(), bid) self._infochan_published_bid_success = True
def test_bid2dict(self): self.assertEqual(testMessages.validBidDict, ipfs_channel.bid2dict(testMessages.getValidBid()))
def test_offer2dict(self): self.assertEqual(testMessages.validBidDict, offer2dict(testMessages.getValidBid()))