mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
housekeep: centralize datetime generation
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
7bcc8d7ce7
commit
7f6c23d4cb
41 changed files with 146 additions and 179 deletions
|
@ -1,8 +1,6 @@
|
|||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
from aurweb import db
|
||||
from aurweb import db, time
|
||||
from aurweb.models import User
|
||||
from aurweb.models.account_type import USER_ID
|
||||
from aurweb.scripts import usermaint
|
||||
|
@ -24,7 +22,7 @@ def user() -> User:
|
|||
def test_usermaint_noop(user: User):
|
||||
""" Last[SSH]Login isn't expired in this test: usermaint is noop. """
|
||||
|
||||
now = int(datetime.utcnow().timestamp())
|
||||
now = time.utcnow()
|
||||
with db.begin():
|
||||
user.LastLoginIPAddress = "127.0.0.1"
|
||||
user.LastLogin = now - 10
|
||||
|
@ -45,7 +43,7 @@ def test_usermaint(user: User):
|
|||
its code path.
|
||||
"""
|
||||
|
||||
now = int(datetime.utcnow().timestamp())
|
||||
now = time.utcnow()
|
||||
limit_to = now - 86400 * 7
|
||||
with db.begin():
|
||||
user.LastLoginIPAddress = "127.0.0.1"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue