fix: add summary column to pages schema, fix test mocks and gateway fake

This commit is contained in:
blankie 2026-07-03 02:35:47 +00:00
parent 83430f68b4
commit ae3f02fa31
3 changed files with 15 additions and 12 deletions

View file

@ -41,7 +41,7 @@ def test_rejects_non_hex(temp_db, csrf_session):
def test_rejects_unreachable_peer(temp_db, csrf_session):
with patch.object(handlers_module, "fetch_remote_sites") as fetch:
with patch("tinyweb.handlers.subscriptions.fetch_remote_sites") as fetch:
fetch.side_effect = ConnectionError("unreachable")
resp = handle_subscription_add({"dest_hash": [VALID_HASH]})
assert "Could not reach" in resp["body"]
@ -49,7 +49,7 @@ def test_rejects_unreachable_peer(temp_db, csrf_session):
def test_rejects_peer_with_sharing_disabled(temp_db, csrf_session):
with patch.object(handlers_module, "fetch_remote_sites") as fetch:
with patch("tinyweb.handlers.subscriptions.fetch_remote_sites") as fetch:
fetch.side_effect = PermissionError("sharing disabled")
resp = handle_subscription_add({"dest_hash": [VALID_HASH]})
assert "sharing disabled" in resp["body"]
@ -57,7 +57,7 @@ def test_rejects_peer_with_sharing_disabled(temp_db, csrf_session):
def test_successful_add_records_subscription(temp_db, csrf_session):
with patch.object(handlers_module, "fetch_remote_sites") as fetch:
with patch("tinyweb.handlers.subscriptions.fetch_remote_sites") as fetch:
fetch.return_value = {"name": "alice", "sites": []}
resp = handle_subscription_add({"dest_hash": [VALID_HASH]})
assert "Subscribed to alice" in resp["body"]
@ -66,7 +66,7 @@ def test_successful_add_records_subscription(temp_db, csrf_session):
def test_dest_hash_strips_angle_brackets(temp_db, csrf_session):
"""Users often paste hashes as `<aaa...>` from RNS log output; strip them."""
with patch.object(handlers_module, "fetch_remote_sites") as fetch:
with patch("tinyweb.handlers.subscriptions.fetch_remote_sites") as fetch:
fetch.return_value = {"name": "bob", "sites": []}
resp = handle_subscription_add({"dest_hash": [f"<{VALID_HASH}>"]})
assert _subscription_count() == 1