feat(api): replace pytz with zoneinfo
Part-of: <https://dev.funkwhale.audio/funkwhale/funkwhale/-/merge_requests/2388>
This commit is contained in:
parent
3490ccf153
commit
94521d2b86
7 changed files with 66 additions and 15 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import sys
|
||||
|
||||
import factory
|
||||
import pytz
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.utils import timezone
|
||||
|
||||
|
|
@ -7,6 +8,11 @@ from funkwhale_api.factories import ManyToManyFromList, NoUpdateOnCreate, regist
|
|||
|
||||
from . import models
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
from backports.zoneinfo import ZoneInfo
|
||||
else:
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
|
||||
@registry.register
|
||||
class GroupFactory(NoUpdateOnCreate, factory.django.DjangoModelFactory):
|
||||
|
|
@ -159,7 +165,7 @@ class GrantFactory(factory.django.DjangoModelFactory):
|
|||
class AccessTokenFactory(factory.django.DjangoModelFactory):
|
||||
application = factory.SubFactory(ApplicationFactory)
|
||||
user = factory.SubFactory(UserFactory)
|
||||
expires = factory.Faker("future_datetime", tzinfo=pytz.UTC)
|
||||
expires = factory.Faker("future_datetime", tzinfo=ZoneInfo("UTC"))
|
||||
token = factory.Faker("uuid4")
|
||||
scope = "read"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue