Run simple test handle
This commit is contained in:
parent
5cbc5a8c35
commit
e6f63a22a3
3 changed files with 12 additions and 3 deletions
|
@ -12,7 +12,7 @@ def execute_handle(executable, request_data):
|
|||
return Result(
|
||||
cmd.returncode,
|
||||
cmd.stdout.decode('utf-8'),
|
||||
cmd.stderr.decode('utf-8')
|
||||
cmd.stderr.decode('utf-8') if cmd.stderr is not None else None
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
from sanic.response import json
|
||||
from sanic.response import html
|
||||
from lantern.handle import execute_handle, get_http_status_code
|
||||
import os
|
||||
|
||||
|
||||
async def main_route(request, path=None):
|
||||
return json({"hello": "world"})
|
||||
handle = os.path.join(os.path.dirname(__file__), 'test_handle.py')
|
||||
result = execute_handle(handle, {})
|
||||
return html(result.html, status=get_http_status_code(result.exit_code))
|
||||
|
|
5
lantern/test_handle.py
Executable file
5
lantern/test_handle.py
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Test handler
|
||||
|
||||
print("<h1>Test</h1>")
|
Reference in a new issue