mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
use declarative_base for all ORM models
This rewrites the entire model base as declarative models. This allows us to more easily customize overlay fields in tables and is more common. This effort also brought some DB violations to light which this commit addresses. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
7f7a975614
commit
888cf5118a
29 changed files with 398 additions and 292 deletions
|
@ -10,12 +10,12 @@ from aurweb.models.session import Session, generate_unique_sid
|
|||
from aurweb.models.user import User
|
||||
from aurweb.testing import setup_test_db
|
||||
|
||||
user = session = None
|
||||
account_type = user = session = None
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def setup():
|
||||
global user, session
|
||||
global account_type, user, session
|
||||
|
||||
setup_test_db("Users", "Sessions")
|
||||
|
||||
|
@ -35,7 +35,10 @@ def test_session():
|
|||
|
||||
def test_session_cs():
|
||||
""" Test case sensitivity of the database table. """
|
||||
session_cs = create(Session, UsersID=user.ID,
|
||||
user2 = create(User, Username="test2", Email="test2@example.org",
|
||||
ResetKey="testReset2", Passwd="testPassword",
|
||||
AccountType=account_type)
|
||||
session_cs = create(Session, UsersID=user2.ID,
|
||||
SessionID="TESTSESSION",
|
||||
LastUpdateTS=datetime.utcnow().timestamp())
|
||||
assert session_cs.SessionID == "TESTSESSION"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue