Skip to content

Commit

Permalink
Upgrade sanic to 23.12.1 (#8)
Browse files Browse the repository at this point in the history
This is the latest sanic LTS.

Moreover, use pytest to run the API tests, as that's what sanic supports
out of the box.
  • Loading branch information
aguinet authored Apr 1, 2024
1 parent 25f1e83 commit 3bb2071
Show file tree
Hide file tree
Showing 5 changed files with 227 additions and 222 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
- name: CLI tests
run: cd cli && pip install -e .[dev] && cd tests && python -m unittest
- name: API tests
run: cd api && pip install -e .[dev] && cd tests && python -m unittest
run: cd api && pip install -e .[dev] && pytest tests
- name: Webapp tests
run: cd webapp && npm i && npm run eslint && npm run test
8 changes: 4 additions & 4 deletions api/secsend_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ async def download(request, id_):
)

@bp.post("/delete/<id_>")
async def upload_finish(request, id_):
async def delete_id(request, id_):
rid = RootID.from_str(id_)
fid = rid.file_id()
f = get_backend(request).open(fid)
Expand Down Expand Up @@ -208,9 +208,9 @@ def declare_app(enable_cors=False, backend_files_root=None, html_root=None, time

if html_root is not None:
app.ctx.html_root = html_root
app.static("/", os.path.join(html_root, "index.html"))
app.static("/", html_root)
app.static("/dl", os.path.join(html_root, "dl.html"))
app.static("/", html_root, name="webapp")
app.static("/", os.path.join(html_root, "index.html"), name="webapp_index")
app.static("/dl", os.path.join(html_root, "dl.html"), name="dl")
else:
print("Warning: no html_root has been specified, sanic won't serve the webapp", file=sys.stderr)

Expand Down
5 changes: 3 additions & 2 deletions api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
packages=['secsend_api'],
install_requires=[
'jsonschema==4.15.*',
'sanic==21.12.*',
'sanic==23.12.1'
],
extras_require={
'dev': [
'sanic-testing==0.8.3',
'sanic-testing==23.12.0',
'pytest_asyncio==0.23.6'
],
}
)
Loading

0 comments on commit 3bb2071

Please sign in to comment.