def test_send_invitation_anon_user(self, account_user, account_account, client): """Integration test with anon user""" outbox_count = len(mail.outbox) backend = ModelInvitation(org_model=Account) invitation = backend.invite_by_email( "*****@*****.**", user=account_user, organization=account_account ) assert isinstance(invitation, OrganizationInvitationBase) assert len(mail.outbox) > outbox_count from django.conf import settings assert list(settings.MIDDLEWARE) response = client.get(invitation.get_absolute_url()) assert response.status_code == 200
def test_invite_returns_invitation(self, account_user, account_account): backend = ModelInvitation(org_model=Account) invitation = backend.invite_by_email("*****@*****.**", user=account_user, organization=account_account) assert isinstance(invitation, OrganizationInvitationBase)
def invitation_backend(): yield ModelInvitation(org_model=Account)
from django.conf.urls import include from django.conf.urls import url from django.contrib import admin from organizations.backends.modeled import ModelInvitation from test_accounts.models import Account admin.autodiscover() app_name = "test_accounts" urlpatterns = [ url( r"^register/", include( ModelInvitation(org_model=Account, namespace="invitations").urls, namespace="account_invitations", ), ) ]
def test_invite_returns_invitation(self, account_user, account_account): backend = ModelInvitation(org_model=Account) invitation = backend.invite_by_email( "*****@*****.**", user=account_user, organization=account_account ) assert isinstance(invitation, OrganizationInvitationBase)