Move NeoMutt integration guides and client contract into CLI releases
This commit is contained in:
1 parent
e3f1be2f6f
commit
7fa71eceb1
8 files changed
+219
-5
No files matched your search
+13
-3
@@ -14,14 +14,19 @@ seen=[]
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
def log_message(self,*args):pass
|
||||
def do_POST(self):
|
||||
self.rfile.read(int(self.headers.get('Content-Length',0)))
|
||||
body=self.rfile.read(int(self.headers.get('Content-Length',0)))
|
||||
if self.path=='/_/auth/login': self.reply({'access_token':token,'token_type':'Bearer','expires_in':3600})
|
||||
elif self.path=='/_/auth/logout':self.reply({})
|
||||
elif self.path=='/_/api/v1/extension/organizer.tasks/capture':
|
||||
if self.headers.get('Authorization')!='Bearer '+token:self.send_error(401);return
|
||||
self.reply({'item':json.loads(body)})
|
||||
else:self.send_error(404)
|
||||
def do_GET(self):
|
||||
if self.headers.get('Authorization')!='Bearer '+token:self.send_error(401);return
|
||||
seen.append(self.path)
|
||||
self.reply({'items':[{'uuid':'synthetic-task','title':'Packaged CLI task','status':'todo'}]})
|
||||
if self.path.startswith('/_/api/v1/extension/organizer.contacts/items?'):
|
||||
self.reply({'items':[{'name':'Synthetic Person','emails':['person@example.invalid'],'organization':'Test'}]})
|
||||
else:self.reply({'items':[{'uuid':'synthetic-task','title':'Packaged CLI task','status':'todo'}]})
|
||||
def reply(self,value):
|
||||
self.send_response(200);self.send_header('Content-Type','application/json');self.end_headers();self.wfile.write(json.dumps(value).encode())
|
||||
|
||||
@@ -38,11 +43,16 @@ try:
|
||||
run('configure','--origin',f'http://127.0.0.1:{server.server_port}','--username','synthetic')
|
||||
run('login',stdin='synthetic-password\n')
|
||||
if 'Packaged CLI task' not in run('task','list'):raise AssertionError('Task missing')
|
||||
mail='Subject: Mail task\r\nMessage-ID: <smoke@example.invalid>\r\nContent-Type: text/plain\r\n\r\nPRIVATE BODY'
|
||||
captured=run('task','from-mail',stdin=mail)
|
||||
if 'Mail task' not in captured or 'PRIVATE BODY' in captured:raise AssertionError('Mail privacy')
|
||||
contact=run('contacts','query','--neomutt','--','--name')
|
||||
if 'person@example.invalid\tSynthetic Person\tTest' not in contact:raise AssertionError('NeoMutt query')
|
||||
run('shell',stdin='pwd\nexit\n')
|
||||
profile=Path(root)/'pages-cli/sessions/default.json'
|
||||
if profile.stat().st_mode&0o077:raise AssertionError('Credential permissions')
|
||||
profile.chmod(0o644);run('task','list',success=False);profile.chmod(0o600)
|
||||
run('logout')
|
||||
if not seen:raise AssertionError('No HTTP request')
|
||||
print('Packaged CLI: configure/login/task-list/permissions/logout passed')
|
||||
print('Packaged CLI: configure/login/task-list/mail-capture/neomutt-query/shell/permissions/logout passed')
|
||||
finally:server.shutdown();server.server_close();thread.join()
|
||||
Reference in new issue
Block a user