tests: django: Fix a warning related timezone settings

The warning is:

RemovedInDjango50Warning: The default value of USE_TZ will change from False to
True in Django 5.0. Set USE_TZ to False in your project settings if you want to
keep the current default behavior.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-03-25 14:49:28 -07:00 committed by James Valleroy
parent f8e78f33d3
commit 70ed89eff9
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 5 additions and 1 deletions

View File

@ -56,3 +56,7 @@ TEMPLATES = [{
'APP_DIRS': True,
'DIRS': ['plinth/tests/data/templates/'],
}]
TIME_ZONE = 'UTC'
USE_TZ = True

View File

@ -386,7 +386,7 @@ def test_display_context(gettext, note, user, rf):
assert context_note['actions'] == expected_actions
assert context_note['data'] == expected_data
assert note.data == data
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
assert (now - context_note['created_time']).seconds < 60
assert (now - context_note['last_update_time']).seconds < 60
assert context_note['user'] == 'test-user'