import time
from datetime import timedelta

import factory
from django.utils import timezone

from oauth.models import OAuth2Token

IN_A_HOUR = timezone.now() + timedelta(hours=1)
IN_A_HOUR_UNIX = int(time.mktime(IN_A_HOUR.timetuple()))


class Oauth2TokenFactory(factory.django.DjangoModelFactory):
    class Meta:
        model = OAuth2Token

    token_type = 'Bearer'
    access_token = 'asdfgghh'
    refresh_token = 'yxcvbnnm'
    expires_at = IN_A_HOUR_UNIX

