コード例 #1
0
    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
コード例 #2
0
    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
コード例 #3
0
 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)
コード例 #4
0
def invitation_backend():
    yield ModelInvitation(org_model=Account)
コード例 #5
0
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",
        ),
    )
]
コード例 #6
0
 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)