def test_result_is_published_on_topic(self): time.sleep(3) #infochan node subscribers may be not registered in master self.infochan_Res_subscriber_topic.publish(testMessages.getValidRes()) timeout_t = time.time() + 60.0 while not rospy.is_shutdown() and not self._infochan_published_res_success and time.time() < timeout_t: time.sleep(0.1) self.assert_(self._infochan_published_res_success)
def test_sign_res(self): rospy.Subscriber('/liability/infochan/eth/sending/result', Result, self.signed_res_handler) resPublisherTest = rospy.Publisher( '/liability/infochan/eth/signing/result', Result, queue_size=10) time.sleep( 3 ) # because signer node subscribers may be not registered in master resPublisherTest.publish(testMessages.getValidRes()) timeout_t = time.time() + 60.0 while not rospy.is_shutdown( ) and not self._test_sign_res_success and time.time() < timeout_t: time.sleep(0.1) self.assert_(self._test_sign_res_success)
def infochan_published_result_handler(self, result): self.assertEqual(testMessages.getValidRes(), result) self._infochan_published_res_success = True
def test_res2dict(self): self.assertEqual(testMessages.validResDict, ipfs_channel.res2dict(testMessages.getValidRes()))