domain method revoking invitations
This commit is contained in:
parent
b0a3172336
commit
75dd0f1249
@ -99,3 +99,8 @@ class Invitations(object):
|
||||
db.session.commit()
|
||||
|
||||
return invite
|
||||
|
||||
@classmethod
|
||||
def revoke(cls, token):
|
||||
invite = Invitations._get(token)
|
||||
return Invitations._update_status(invite, InvitationStatus.REVOKED)
|
||||
|
@ -93,3 +93,13 @@ def test_accept_invitation_twice():
|
||||
Invitations.accept(user, invite.token)
|
||||
with pytest.raises(InvitationError):
|
||||
Invitations.accept(user, invite.token)
|
||||
|
||||
|
||||
def test_revoke_invitation():
|
||||
workspace = WorkspaceFactory.create()
|
||||
user = UserFactory.create()
|
||||
ws_role = WorkspaceRoleFactory.create(user=user, workspace=workspace)
|
||||
invite = Invitations.create(ws_role, workspace.owner, user)
|
||||
assert invite.is_pending
|
||||
Invitations.revoke(invite.token)
|
||||
assert invite.is_revoked
|
||||
|
Loading…
x
Reference in New Issue
Block a user