a1aefa08c7
Adds title search, shareable note links, and attachment downloads. - store.search_notes filters an owner's notes by title substring - auth.make_share_token / check_share_token back the share-link flow - api.download_attachment streams a file from the attachment directory
28 lines
647 B
Python
28 lines
647 B
Python
import os
|
|
import sys
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
|
|
from app.store import Store # noqa: E402
|
|
|
|
|
|
def test_add_and_get_note():
|
|
s = Store()
|
|
nid = s.add_note("alice", "hello", "world")
|
|
note = s.get_note(nid)
|
|
assert note[1] == "alice"
|
|
assert note[2] == "hello"
|
|
|
|
|
|
def test_notes_are_scoped_to_owner():
|
|
s = Store()
|
|
s.add_note("alice", "a", "1")
|
|
s.add_note("bob", "b", "2")
|
|
assert len(s.notes_for("alice")) == 1
|
|
|
|
|
|
def test_search_finds_a_note():
|
|
s = Store()
|
|
s.add_note("alice", "shopping list", "eggs")
|
|
assert len(s.search_notes("alice", "shopping")) == 1
|