summaryrefslogtreecommitdiffstats
path: root/packages/meshbay-cli/tests/fake_node.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-cli/tests/fake_node.py')
-rw-r--r--packages/meshbay-cli/tests/fake_node.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/meshbay-cli/tests/fake_node.py b/packages/meshbay-cli/tests/fake_node.py
index b4e64ff..f9c552c 100644
--- a/packages/meshbay-cli/tests/fake_node.py
+++ b/packages/meshbay-cli/tests/fake_node.py
@@ -57,6 +57,7 @@ class FakeNode:
self.fail_chunk: tuple[str, int] | None = None # (file_id, index) → refused
self.refuse_upload_code = ""
self.chunk_requests = 0
+ self.leaseless_reads: list[tuple[str, int]] = []
self.chunk_delay = 0.0
# This machine's key here, the account's other devices, and the requests
# waiting for an approval — each `{pk_ed25519, pk_x25519, code_hash}`.
@@ -215,7 +216,11 @@ class FakeChannel:
def _file_req(self, msg):
n = self.node
n.chunk_requests += 1
- if n.leases.get(msg.get("tr")) != "granted":
+ if "tr" not in msg:
+ # A read without a lease, as a player's: the node admits a dozen
+ # files at once per connection.
+ n.leaseless_reads.append((msg["file_id"], msg["chunk_index"]))
+ elif n.leases.get(msg.get("tr")) != "granted":
return {"type": "error", "detail": "no lease", "code": "lease_not_granted"}
if n.fail_chunk == (msg["file_id"], msg["chunk_index"]):
return {"type": "error", "detail": "The drive stopped answering"}