mirror of
https://github.com/markqvist/Reticulum.git
synced 2025-06-01 04:55:49 -04:00
Updated link tests
This commit is contained in:
parent
4d7f5b8ca6
commit
3dc260a300
1 changed files with 9 additions and 9 deletions
|
@ -493,12 +493,12 @@ class TestLink(unittest.TestCase):
|
||||||
resource_size = 5*1000*1000
|
resource_size = 5*1000*1000
|
||||||
data = os.urandom(resource_size)
|
data = os.urandom(resource_size)
|
||||||
print("Sending "+self.size_str(resource_size)+" resource...")
|
print("Sending "+self.size_str(resource_size)+" resource...")
|
||||||
resource = RNS.Resource(data, l1, timeout=resource_timeout, auto_compress=False)
|
resource = RNS.Resource(data, l1, timeout=resource_timeout, callback=self.lr_callback, auto_compress=False)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
# This is a hack, don't do it. Use the callbacks instead.
|
TestLink.large_resource_status = resource.status
|
||||||
while resource.status < RNS.Resource.COMPLETE:
|
while TestLink.large_resource_status < RNS.Resource.COMPLETE:
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
|
|
||||||
t = time.time() - start
|
t = time.time() - start
|
||||||
self.assertEqual(resource.status, RNS.Resource.COMPLETE)
|
self.assertEqual(resource.status, RNS.Resource.COMPLETE)
|
||||||
|
@ -508,12 +508,12 @@ class TestLink(unittest.TestCase):
|
||||||
data = os.urandom(resource_size)
|
data = os.urandom(resource_size)
|
||||||
metadata = {"text": "Some text", "numbers": [1,2,3,4], "blob": os.urandom(8192)}
|
metadata = {"text": "Some text", "numbers": [1,2,3,4], "blob": os.urandom(8192)}
|
||||||
print("Sending "+self.size_str(resource_size)+" resource with metadata...")
|
print("Sending "+self.size_str(resource_size)+" resource with metadata...")
|
||||||
resource = RNS.Resource(data, l1, metadata=metadata, timeout=resource_timeout)
|
resource = RNS.Resource(data, l1, timeout=resource_timeout, callback=self.lr_callback, auto_compress=False)
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
||||||
# This is a hack, don't do it. Use the callbacks instead.
|
TestLink.large_resource_status = resource.status
|
||||||
while resource.status < RNS.Resource.COMPLETE:
|
while TestLink.large_resource_status < RNS.Resource.COMPLETE:
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
|
|
||||||
t = time.time() - start
|
t = time.time() - start
|
||||||
self.assertEqual(resource.status, RNS.Resource.COMPLETE)
|
self.assertEqual(resource.status, RNS.Resource.COMPLETE)
|
||||||
|
@ -560,7 +560,7 @@ class TestLink(unittest.TestCase):
|
||||||
|
|
||||||
TestLink.large_resource_status = resource.status
|
TestLink.large_resource_status = resource.status
|
||||||
while TestLink.large_resource_status < RNS.Resource.COMPLETE:
|
while TestLink.large_resource_status < RNS.Resource.COMPLETE:
|
||||||
time.sleep(0.01)
|
time.sleep(0.001)
|
||||||
|
|
||||||
t = time.time() - start
|
t = time.time() - start
|
||||||
self.assertEqual(TestLink.large_resource_status, RNS.Resource.COMPLETE)
|
self.assertEqual(TestLink.large_resource_status, RNS.Resource.COMPLETE)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue