specify unit for invitation expiration
This commit is contained in:
parent
5c2d466049
commit
edede87108
@ -17,7 +17,8 @@ class InvitationExpired(Exception):
|
||||
|
||||
|
||||
class Invitations(object):
|
||||
EXPIRATION_LIMIT = 360
|
||||
# number of minutes a given invitation is considered valid
|
||||
EXPIRATION_LIMIT_MINUTES = 360
|
||||
|
||||
@classmethod
|
||||
def _get(cls, invite_id):
|
||||
@ -58,6 +59,6 @@ class Invitations(object):
|
||||
def is_expired(cls, invite):
|
||||
time_created = invite.time_created
|
||||
expiration = datetime.datetime.now(time_created.tzinfo) - datetime.timedelta(
|
||||
minutes=Invitations.EXPIRATION_LIMIT
|
||||
minutes=Invitations.EXPIRATION_LIMIT_MINUTES
|
||||
)
|
||||
return invite.time_created < expiration
|
||||
|
@ -27,7 +27,7 @@ def test_accept_invitation():
|
||||
def test_accept_expired_invitation():
|
||||
workspace = WorkspaceFactory.create()
|
||||
user = UserFactory.create()
|
||||
increment = Invitations.EXPIRATION_LIMIT + 1
|
||||
increment = Invitations.EXPIRATION_LIMIT_MINUTES + 1
|
||||
created_at = datetime.datetime.now() - datetime.timedelta(minutes=increment)
|
||||
invite = InvitationFactory.create(
|
||||
workspace_id=workspace.id, user_id=user.id, time_created=created_at, valid=True
|
||||
|
Loading…
x
Reference in New Issue
Block a user