From 629efb253e81ccde63514f401f81c1d3a262739d Mon Sep 17 00:00:00 2001 From: Lee Miller Date: Fri, 5 Apr 2024 00:20:16 +0300 Subject: [PATCH] Update the test for disseminatePreEncryptedMsg API command --- src/tests/test_api_thread.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/tests/test_api_thread.py b/src/tests/test_api_thread.py index 5b004066..5abc13bb 100644 --- a/src/tests/test_api_thread.py +++ b/src/tests/test_api_thread.py @@ -8,9 +8,7 @@ from struct import pack from six.moves import queue, xmlrpc_client from pybitmessage import protocol -from pybitmessage.defaults import ( - networkDefaultProofOfWorkNonceTrialsPerByte, - networkDefaultPayloadLengthExtraBytes) +from pybitmessage.highlevelcrypto import calculateInventoryHash from .partial import TestPartialRun from .samples import sample_statusbar_msg, sample_object_data @@ -80,12 +78,14 @@ class TestAPIThread(TestPartialRun): from inventory import Inventory proofofwork.init() - update_object = pack( + self.assertEqual( + unhexlify(self.api.disseminatePreparedObject( + hexlify(sample_object_data).decode())), + calculateInventoryHash(sample_object_data)) + update_object = b'\x00' * 8 + pack( '>Q', int(time.time() + 7200)) + sample_object_data[16:] invhash = unhexlify(self.api.disseminatePreEncryptedMsg( - hexlify(update_object).decode(), - networkDefaultProofOfWorkNonceTrialsPerByte, - networkDefaultPayloadLengthExtraBytes + hexlify(update_object).decode() )) obj_type, obj_stream, obj_data = Inventory()[invhash][:3] self.assertEqual(obj_type, 42)