def test_getOTS(self): with set_qrl_dir("wallet_ver1"): walletd = WalletD() service = WalletAPIService(walletd) walletd._public_stub.GetOTS = Mock( return_value=qrl_pb2.GetOTSResp(ots_bitfield=[b'\x00'] * 10, next_unused_ots_index=1)) resp = service.GetOTS(qrlwallet_pb2.OTSReq(address=self.qaddress), context=None) self.assertEqual(resp.code, 0) self.assertEqual(resp.ots_bitfield, [b'\x00'] * 10) self.assertEqual(resp.next_unused_ots_index, 1)
def test_getOTS(self): with set_qrl_dir("wallet_ver1"): walletd = WalletD() service = WalletAPIService(walletd) ots_bitfield_by_page = qrl_pb2.OTSBitfieldByPage(ots_bitfield=[b'\x00'] * 10, page_number=1) walletd._public_stub.GetOTS = Mock( return_value=qrl_pb2.GetOTSResp(ots_bitfield_by_page=[ots_bitfield_by_page], next_unused_ots_index=1, unused_ots_index_found=True)) resp = service.GetOTS(qrlwallet_pb2.OTSReq(address=self.qaddress), context=None) self.assertEqual(resp.code, 0) self.assertEqual(len(resp.ots_bitfield_by_page), 1) self.assertEqual(resp.ots_bitfield_by_page[0], ots_bitfield_by_page) self.assertEqual(resp.next_unused_ots_index, 1)