Switch to pynostr

This commit is contained in:
thePR0M3TH3AN
2025-06-30 20:55:46 -04:00
parent 87a493b845
commit f60eaa4a1e
5 changed files with 164 additions and 662 deletions

View File

@@ -16,11 +16,11 @@ def test_nostr_client_uses_custom_relays():
enc_mgr = EncryptionManager(key, Path(tmpdir))
custom_relays = ["wss://relay1", "wss://relay2"]
with patch("nostr.client.ClientPool") as MockPool, patch(
with patch("nostr.client.WebSocketRelayManager") as MockPool, patch(
"nostr.client.KeyManager"
), patch.object(NostrClient, "initialize_client_pool"):
):
with patch.object(enc_mgr, "decrypt_parent_seed", return_value="seed"):
client = NostrClient(enc_mgr, "fp", relays=custom_relays)
MockPool.assert_called_with(custom_relays)
MockPool.assert_called_with()
assert client.relays == custom_relays

View File

@@ -14,7 +14,7 @@ def setup_client(tmp_path):
key = Fernet.generate_key()
enc_mgr = EncryptionManager(key, tmp_path)
with patch("nostr.client.ClientPool"), patch(
with patch("nostr.client.WebSocketRelayManager"), patch(
"nostr.client.KeyManager"
), patch.object(NostrClient, "initialize_client_pool"), patch.object(
enc_mgr, "decrypt_parent_seed", return_value="seed"
@@ -27,10 +27,10 @@ class FakeEvent:
KIND_TEXT_NOTE = 1
KIND_ENCRYPT = 2
def __init__(self, kind, content, pub_key):
def __init__(self, kind, content, pub_key=None):
self.kind = kind
self.content = content
self.pub_key = pub_key
self.pubkey = pub_key
self.id = "id"
def sign(self, _):