feat: atomically capture task mail into Wiki and persist destination defaults
This commit is contained in:
1 parent
52b501d1ce
commit
80d297dab4
14 files changed
+525
-30
No files matched your search
@@ -5,6 +5,8 @@ import json
|
||||
from pathlib import Path
|
||||
import runpy
|
||||
import sys
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import patch
|
||||
|
||||
def run():
|
||||
m=runpy.run_path(str(Path(__file__).with_name('pages')))
|
||||
@@ -26,6 +28,16 @@ def run():
|
||||
task('done',ident)
|
||||
report=task('report','--json');assert sum(d['points'] for d in report['days'])==7
|
||||
assert any(i['uuid']==ident for i in report['tasks'])
|
||||
task('preferences','--wiki-prefix','/private/mail')
|
||||
mail=b'Subject: CLI mail\r\nMessage-ID: <integration@example.invalid>\r\nContent-Type: text/plain; charset=utf-8\r\n\r\nPrivate mail body {{children}}'
|
||||
with patch('sys.stdin',SimpleNamespace(buffer=io.BytesIO(mail))):
|
||||
captured=task('from-mail')
|
||||
assert captured['item']['page_uuid'] and captured['page_path'].startswith('/private/mail/CLI mail--')
|
||||
assert 'Private mail body' not in captured['item']['notes']
|
||||
with patch('sys.stdin',SimpleNamespace(buffer=io.BytesIO(mail))):
|
||||
assert task('from-mail')['item']['page_uuid']==captured['item']['page_uuid']
|
||||
note=client.json(m['TASK_API']+'items/'+captured['item']['uuid']+'/note')
|
||||
assert note['linked'] and note['path']==captured['page_path']
|
||||
path=Path(fixture['root'])/'person.vcf'
|
||||
path.write_text('BEGIN:VCARD\r\nVERSION:4.0\r\nUID:urn:test:cli\r\nFN:CLI Person\r\nEMAIL:cli@example.invalid\r\nEND:VCARD\r\n')
|
||||
output=io.StringIO()
|
||||
|
||||
Reference in new issue
Block a user