コード例 #1
0
ファイル: test_views.py プロジェクト: SanomaCZ/django-entree
    def test_form_valid_send_activation_mail(self, mocked_send):
        mocked_send.return_value = True

        data = {
            'email': self.email,
            'password': self.password,
            'password2': self.password,
        }

        self.request.method = 'POST'
        self.request.POST = data

        ViewClass = csrf_exempt(CreateIdentityView.as_view())
        ViewClass(self.request, origin_site=self.valid_site.pk)

        assert_equals(True, mocked_send.called)
        assert LoginToken.objects.get(user=self.request.entree_user, token_type=MAIL_TOKEN)
コード例 #2
0
    def test_form_valid_creates_identity_and_login(self):
        data = {
            'email': self.email,
            'password': self.password,
            'password2': self.password,
        }

        self.request.method = 'POST'
        self.request.POST = data

        ViewClass = csrf_exempt(CreateIdentityView.as_view())
        ViewClass(self.request, origin_site=self.valid_site.pk)

        identity = Identity.objects.get(email=self.email)

        assert_equals(identity, self.request.entree_user)
        assert_equals(False, identity.mail_verified)
コード例 #3
0
ファイル: test_views.py プロジェクト: SanomaCZ/django-entree
    def test_form_valid_creates_identity_and_login(self):
        data = {
            'email': self.email,
            'password': self.password,
            'password2': self.password,
        }

        self.request.method = 'POST'
        self.request.POST = data

        ViewClass = csrf_exempt(CreateIdentityView.as_view())
        ViewClass(self.request, origin_site=self.valid_site.pk)

        identity = Identity.objects.get(email=self.email)

        assert_equals(identity, self.request.entree_user)
        assert_equals(False, identity.mail_verified)
コード例 #4
0
    def test_form_valid_send_activation_mail(self, mocked_send):
        mocked_send.return_value = True

        data = {
            'email': self.email,
            'password': self.password,
            'password2': self.password,
        }

        self.request.method = 'POST'
        self.request.POST = data

        ViewClass = csrf_exempt(CreateIdentityView.as_view())
        ViewClass(self.request, origin_site=self.valid_site.pk)

        assert_equals(True, mocked_send.called)
        assert LoginToken.objects.get(user=self.request.entree_user,
                                      token_type=MAIL_TOKEN)
コード例 #5
0
ファイル: test_views.py プロジェクト: SanomaCZ/django-entree
 def test_create_with_site_id_pass(self):
     ViewClass = CreateIdentityView.as_view()
     res = ViewClass(self.request, origin_site=self.valid_site.pk)
     assert_equals(type(res), TemplateResponse)
コード例 #6
0
ファイル: test_views.py プロジェクト: SanomaCZ/django-entree
 def test_create_without_site_id_raises_404(self):
     ViewClass = CreateIdentityView.as_view()
     assert_raises(Http404, lambda: ViewClass(self.request))
コード例 #7
0
ファイル: urls.py プロジェクト: yedpodtrzitko/django-entree
urlpatterns = patterns('entree.enauth.views',
    url(r'^api/show/(?P<site_id>\d+)/$', ShowApiView.as_view(), name='api_show'),
    url(r'^api/show/$', ShowApiView.as_view(), name='api_show'),
    url(r'^iframe-login/$', LoginHashView.as_view(), name='login_hash'),

    url(r'^login/recovery/(?P<origin_site>\d+)/$', RecoveryLoginView.as_view(), name='login-recovery'),

    url(r'^login/$', LoginView.as_view(), name='login'),  # dummy url
    url(r'^login/(?P<origin_site>\d+)/$', LoginView.as_view(), name='login'),
    url(r'^login/(?P<origin_site>\d+)/(?P<next_url>\S+)/$', LoginView.as_view(), name='login'),

    url(r'^logout/$', LogoutView.as_view(), name='logout'),  # dummy url
    url(r'^logout/(?P<origin_site>\d+)/$', LogoutView.as_view(), name='logout'),
    url(r'^logout/(?P<origin_site>\d+)/(?P<next_url>\S+)/$', LogoutView.as_view(), name='logout'),

    url(r'^register/$', CreateIdentityView.as_view(), name='register'),  # dummy url
    url(r'^register/(?P<origin_site>\d+)/$', CreateIdentityView.as_view(), name='register'),
    url(r'^register/(?P<origin_site>\d+)/(?P<next_url>\S+)/$', CreateIdentityView.as_view(), name='create_identity'),

    #each of these urls below should start w/ the same string
    #there's middleware which controls inactive account if: url.startswith(reverse('verify_identity'))
    url(r'^verify/$', IdentityVerifyView.as_view(), name='verify_identity'),
    url(r'^verify/(?P<email>[A-Za-z0-9=]+)/(?P<token>\w+)/$', IdentityVerifyView.as_view(), name='verify_identity'),

    url(r'^verify/resend/$', IdentityVerifyResend.as_view(), name='verify_resend'),
    # ^ each of these urls above should start w/ the same string

    url(r'^password-change/$', PasswordChangeView.as_view(), name='password_change'),
    url(r'^password-recovery/$', PasswordRecoveryRequestView.as_view(), name='password_recovery'),
    url(r'^password-recovery/finish/(?P<email>[A-Za-z0-9=]+)/(?P<token>\S+)/$', PasswordResetView.as_view(), name='recovery_finish'),
    url(r'^password-recovery/finish/$', FinishRecoveryView.as_view(), name='recovery_finish'),
コード例 #8
0
 def test_create_with_site_id_pass(self):
     ViewClass = CreateIdentityView.as_view()
     res = ViewClass(self.request, origin_site=self.valid_site.pk)
     assert_equals(type(res), TemplateResponse)
コード例 #9
0
 def test_create_without_site_id_raises_404(self):
     ViewClass = CreateIdentityView.as_view()
     assert_raises(Http404, lambda: ViewClass(self.request))
コード例 #10
0
    url(r'^iframe-login/$', LoginHashView.as_view(), name='login_hash'),
    url(r'^login/recovery/(?P<origin_site>\d+)/$',
        RecoveryLoginView.as_view(),
        name='login-recovery'),
    url(r'^login/$', LoginView.as_view(), name='login'),  #dummy url
    url(r'^login/(?P<origin_site>\d+)/$', LoginView.as_view(), name='login'),
    url(r'^login/(?P<origin_site>\d+)/(?P<next_url>\S+)/$',
        LoginView.as_view(),
        name='login'),
    url(r'^logout/$', LogoutView.as_view(), name='logout'),  #dummy url
    url(r'^logout/(?P<origin_site>\d+)/$', LogoutView.as_view(),
        name='logout'),
    url(r'^logout/(?P<origin_site>\d+)/(?P<next_url>\S+)/$',
        LogoutView.as_view(),
        name='logout'),
    url(r'^register/$', CreateIdentityView.as_view(),
        name='register'),  #dummy url
    url(r'^register/(?P<origin_site>\d+)/$',
        CreateIdentityView.as_view(),
        name='register'),
    url(r'^register/(?P<origin_site>\d+)/(?P<next_url>\S+)/$',
        CreateIdentityView.as_view(),
        name='create_identity'),

    #each of these urls below should start w/ the same string
    #there's middleware which controls inactive account if: url.startswith(reverse('verify_identity'))
    url(r'^verify/$', IdentityVerifyView.as_view(), name='verify_identity'),
    url(r'^verify/(?P<email>[A-Za-z0-9=]+)/(?P<token>\w+)/$',
        IdentityVerifyView.as_view(),
        name='verify_identity'),
    url(r'^verify/resend/$',