from django.conf.urls.defaults import * from django_users.invitations.urls import invites_urlpatterns from django_users.authentication.views import Login, Logout from django_users.registration.views import Registration # Authentication views login_urlpatterns = patterns('', url('^login/$', Login.as_view(), name='django_users_login'), url('^logout/$', Logout.as_view(), name='django_users_logout'), ) # Registration urlpatterns registration_urlpatterns = patterns('', url('^registration/$', Registration.as_view(), name='django_users_registration'), ) urlpatterns = login_urlpatterns + registration_urlpatterns urlpatterns = invites_urlpatterns + urlpatterns
self.client.post(self.url, {'username': USERNAME, 'password': PASSWORD + '_WRONG'}) self.assertRaises(TriggerException, check_call) wrong_password.disconnect(receiver=self.trigger) def test_signal_logged_in(self): def check_call(): logged_in.connect(receiver=self.trigger) self.client.get(self.url) self.client.post(self.url, {'username': USERNAME, 'password': PASSWORD}) self.assertRaises(TriggerException, check_call) logged_in.disconnect(receiver=self.trigger) ############################################################################### def index(request): return render(request, 'django_users/tests/index.html') urlpatterns = patterns('', url('^index/$', index), url('^django_logout/$', Logout.as_view(), name='django_users_logout'), url('^django_login/$', Login.as_view(template_name = LOGIN_CUSTOM_TEMPLATE_NAME, login_url = LOGIN_CUSTOM_LOGIN_URL, redirect_url = LOGIN_CUSTOM_REDIRECT_URL, form_class = LOGIN_CUSTOM_FORM_CLASS, ), name='django_users_login'), )