Skip to content

Commit 3373220

Browse files
committed
Fix tests
1 parent ce00ed3 commit 3373220

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

server/mergin/tests/test_auth.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
44

5-
from datetime import datetime, timedelta, timezone
5+
from datetime import datetime, timedelta
66
import time
77
import itsdangerous
88
import pytest
@@ -138,7 +138,7 @@ def assert_locked():
138138
# counter was at 3; one new failure pushes it to 4, crossing tier-2 threshold
139139

140140
# expire_lock
141-
user.locked_until = datetime.now(tz=timezone.utc) - timedelta(seconds=1)
141+
user.locked_until = datetime.utcnow() - timedelta(seconds=1)
142142
db.session.commit()
143143

144144
resp = client.post(
@@ -148,11 +148,11 @@ def assert_locked():
148148
# returns 401 (wrong password), but now locked for 3600s
149149
assert resp.status_code == 401
150150
assert_locked()
151-
assert user.locked_until > datetime.now(tz=timezone.utc) + timedelta(seconds=60)
151+
assert user.locked_until > datetime.utcnow() + timedelta(seconds=60)
152152
assert user.failed_login_attempts == 4
153153

154154
# successful login after expiry resets everything
155-
user.locked_until = datetime.now(tz=timezone.utc) - timedelta(seconds=1)
155+
user.locked_until = datetime.utcnow() - timedelta(seconds=1)
156156
db.session.commit()
157157
resp = client.post(
158158
url_for("/.mergin_auth_controller_login"),

server/migrations/community/a3c8f2e1d947_add_login_lockout_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# revision identifiers, used by Alembic.
1414
revision = "a3c8f2e1d947"
15-
down_revision = "a1b2c3d4e5f6"
15+
down_revision = "f1d9e4a7b823"
1616
branch_labels = None
1717
depends_on = None
1818

0 commit comments

Comments
 (0)