mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-14 18:19:37 +00:00
Return success status from Nostr publish
This commit is contained in:
27
src/tests/test_post_sync_messages.py
Normal file
27
src/tests/test_post_sync_messages.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
||||
|
||||
import main
|
||||
|
||||
|
||||
def test_handle_post_success(capsys):
|
||||
pm = SimpleNamespace(
|
||||
get_encrypted_data=lambda: b"data",
|
||||
nostr_client=SimpleNamespace(publish_json_to_nostr=lambda data: True),
|
||||
)
|
||||
main.handle_post_to_nostr(pm)
|
||||
out = capsys.readouterr().out
|
||||
assert "✅ Sync complete." in out
|
||||
|
||||
|
||||
def test_handle_post_failure(capsys):
|
||||
pm = SimpleNamespace(
|
||||
get_encrypted_data=lambda: b"data",
|
||||
nostr_client=SimpleNamespace(publish_json_to_nostr=lambda data: False),
|
||||
)
|
||||
main.handle_post_to_nostr(pm)
|
||||
out = capsys.readouterr().out
|
||||
assert "❌ Sync failed…" in out
|
Reference in New Issue
Block a user