refactor: remove redundant comments and docstrings (#6527)
* refactor: remove redundant comments and docstrings * fix(signal): annotate async context manager as a generator
This commit is contained in:
1 parent
cb3ba45317
commit
a4d2430140
922 files changed
+406
-7738
No files matched your search
@@ -1,5 +1,3 @@
|
||||
"""Pairing protocol, restricted authorization and local API regression tests."""
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
@@ -182,7 +180,6 @@ def test_paired_transport_cannot_fall_back_to_generic_probe_or_forwarding(pair,
|
||||
|
||||
@pytest.mark.parametrize("command", ["echo MUST-NOT-EXECUTE", "nanobot-remote-bridge-v2"])
|
||||
def test_fixed_bridge_streams_only_to_baked_in_loopback_port(tmp_path, command):
|
||||
# Real bidirectional bytes, no SSH_ORIGINAL_COMMAND interpolation.
|
||||
listener = socket.socket()
|
||||
listener.bind(("127.0.0.1", 0))
|
||||
listener.listen(1)
|
||||
@@ -228,7 +225,7 @@ def test_guarded_bridge_rejects_new_channels_without_connecting(tmp_path, reason
|
||||
result = subprocess.run([sys.executable, "-I", "-S", str(bridge)], capture_output=True, timeout=5,
|
||||
env={**os.environ, "SSH_ORIGINAL_COMMAND": "nanobot-remote-bridge-v2"})
|
||||
assert result.returncode == 1
|
||||
assert not result.stdout # No reuse capability or connection to the target.
|
||||
assert not result.stdout
|
||||
assert b"Permission denied" in result.stderr
|
||||
|
||||
|
||||
@@ -298,10 +295,10 @@ async def test_repeated_pairing_groups_one_instance_without_deleting_authorizati
|
||||
code = seal(second, renewed)
|
||||
preview = await manager.action("pair_preview", {"id": second.id, "code": code})
|
||||
assert preview["existing_connection"] == {"id": first.id, "name": "My team", "connected": False}
|
||||
assert len(manager.snapshot()["profiles"]) == 1 # Preview never saves or deletes.
|
||||
assert len(manager.snapshot()["profiles"]) == 1
|
||||
result = await manager.action("pair_finish", {"id": second.id, "code": code})
|
||||
assert result["id"] == second.id
|
||||
assert len(result["profiles"]) == 2 # Grants remain separately manageable.
|
||||
assert len(result["profiles"]) == 2
|
||||
assert {item["instance_id"] for item in result["profiles"]} == {first.id}
|
||||
assert {item["name"] for item in result["profiles"]} == {"My team"}
|
||||
assert manager.pairing.path(first.id).joinpath("identity").read_bytes() == before
|
||||
@@ -511,7 +508,6 @@ def test_expired_device_cannot_connect(pair, monkeypatch):
|
||||
monkeypatch.setattr(remote_pairing.time, "time", lambda: value.authorized_until + 1)
|
||||
with pytest.raises(RemoteError, match="pair_authorization_expired"):
|
||||
store.connection(request.id)
|
||||
# The UI can explain expiry without opening a path around connection().
|
||||
assert store.authorization_until(request.id) == value.authorized_until
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user