Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Add tzinfo in factory generated access tokens (#2497)
Staci Mullinsf673fb3bfb8d
diff --git a/api/pytest.ini b/api/pytest.iniindex d3050137c..13025b508 100644--- a/api/pytest.ini+++ b/api/pytest.ini@@ -5,5 +5,4 @@ pythonpath = .filterwarnings=ignore:Unverified HTTPS request- ignore:DateTimeField AccessToken\.expires received a naive datetimeignore:The default value of USE_TZ will change from False to True in Django 5.0diff --git a/api/test/factory/models/oauth2.py b/api/test/factory/models/oauth2.pyindex 400c89605..6a749654e 100644--- a/api/test/factory/models/oauth2.py+++ b/api/test/factory/models/oauth2.py@@ -1,5 +1,7 @@from test.factory.faker import Faker+from django.utils import timezone+import factoryfrom factory.django import DjangoModelFactoryfrom oauth2_provider.models import AccessToken@@ -47,5 +49,10 @@ class AccessTokenFactory(DjangoModelFactory):model = AccessTokentoken = Faker("uuid4")- expires = Faker("date_time_between", start_date="+1y", end_date="+2y")+ expires = Faker(+ "date_time_between",+ start_date="+1y",+ end_date="+2y",+ tzinfo=timezone.get_current_timezone(),+ )application = factory.SubFactory(ThrottledApplicationFactory)