mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
housekeep(fastapi): rework aurweb.db session API
Changes: ------- - Add aurweb.db.get_session() - Returns aurweb.db's global `session` instance - Provides us a way to change the implementation of the session instance without interrupting user code. - Use aurweb.db.get_session() in session API methods - Add docstrings to session API methods - Refactor aurweb.db.delete - Normalize aurweb.db.delete to an alias of session.delete - Refresh instances in places we depend on their non-PK columns being up to date. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
f8ba2c5342
commit
4103ab49c9
22 changed files with 212 additions and 138 deletions
|
@ -2,6 +2,7 @@ from datetime import datetime
|
|||
|
||||
import pytest
|
||||
|
||||
from fastapi import HTTPException
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from aurweb import asgi, db
|
||||
|
@ -98,3 +99,8 @@ def test_query_notified(maintainer: User, package: Package):
|
|||
query = db.query(Package).filter(Package.ID == package.ID).all()
|
||||
query_notified = util.query_notified(query, maintainer)
|
||||
assert query_notified[package.PackageBase.ID]
|
||||
|
||||
|
||||
def test_pkgreq_by_id_not_found():
|
||||
with pytest.raises(HTTPException):
|
||||
util.get_pkgreq_by_id(0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue