diff --git a/gregui/api/views/invitation.py b/gregui/api/views/invitation.py index 9b0f58ad5bd9a77ec8d463d0685a641ef52751f0..2fd4485434a29cc01ceda0b9ee8337dd2f264b1c 100644 --- a/gregui/api/views/invitation.py +++ b/gregui/api/views/invitation.py @@ -78,7 +78,10 @@ class InvitationView(CreateAPIView, DestroyAPIView): # TODO Determine if person should be deleted as well if invitationlink: - if invitationlink.invitation.role.person.is_registered or invitationlink.invitation.role.person.is_verified: + if ( + invitationlink.invitation.role.person.is_registered + or invitationlink.invitation.role.person.is_verified + ): # The guest has already gone through the registration step. The guest should # not be verified, but including that check just in case here return Response(status.HTTP_400_BAD_REQUEST) @@ -262,7 +265,7 @@ class InvitedGuestView(GenericAPIView): @staticmethod def _get_identity_or_none( - person: Person, identity_type: Identity.IdentityType + person: Person, identity_type: Identity.IdentityType ) -> Optional[str]: try: return person.identities.get(type=identity_type).value diff --git a/gregui/tests/api/test_invite_guest.py b/gregui/tests/api/test_invite_guest.py index 9e95b3693dc8b1aa22ca46c81035a35d902808b5..0f265b1e44311d0001c0d6e7f444f3c6305a1d42 100644 --- a/gregui/tests/api/test_invite_guest.py +++ b/gregui/tests/api/test_invite_guest.py @@ -16,10 +16,10 @@ def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo): "email": "test@example.com", "role": { "start_date": ( - datetime.datetime.today() + datetime.timedelta(days=1) + datetime.datetime.today() + datetime.timedelta(days=1) ).strftime("%Y-%m-%d"), "end_date": ( - datetime.datetime.today() + datetime.timedelta(days=10) + datetime.datetime.today() + datetime.timedelta(days=10) ).strftime("%Y-%m-%d"), "orgunit": unit_foo.id, "type": role_type_foo.id, @@ -52,7 +52,9 @@ def test_invite_guest(client, user_sponsor, unit_foo, role_type_foo): @pytest.mark.django_db -def test_invite_cancel(client, invitation_link, invitation, role, log_in, sponsor_guy, user_sponsor): +def test_invite_cancel( + client, invitation_link, invitation, role, log_in, sponsor_guy, user_sponsor +): # TODO: Should all sponsors be allowed to delete arbitrary invitations? log_in(user_sponsor) url = reverse("gregui-v1:invitation")