def test_home_form_view_not_logged(self): view = HomeFormView.as_view() request = self.request_factory.get(reverse('home')) request.user = self.user response = view(request) self.assertEqual(response.status_code, 302) self.assertEqual(response.get('location'), reverse('dashboard_view'))
def test_home_form_view_logger(self, mock_is_authenticated): mock_is_authenticated.return_value = False view = HomeFormView.as_view() request = self.request_factory.get(reverse('home')) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200)
def test_home_form_login(self): data = {'username': '******', 'password': self.password} view = HomeFormView.as_view() request = self.request_factory.post(reverse('home'), data) request.user = self.user setattr(request, 'session', self.session) response = view(request) self.assertEqual(response.status_code, 302)
def test_home_form_view_not_logged(self): view = HomeFormView.as_view() request = self.request_factory.get( reverse('home') ) request.user = self.user response = view(request) self.assertEqual(response.status_code, 302) self.assertEqual(response.get('location'), reverse('dashboard_view'))
def test_home_form_login_fail(self): data = {'username': '******', 'password': '******'} view = HomeFormView.as_view() request = self.request_factory.post(reverse('home'), data) request.user = self.user setattr(request, 'session', self.session) setattr(request, '_messages', FallbackStorage(request)) response = view(request) self.assertEqual(response.status_code, 200)
def test_home_form_view_logger(self, mock_is_authenticated): mock_is_authenticated.return_value = False view = HomeFormView.as_view() request = self.request_factory.get( reverse('home') ) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200)
def test_home_form_login(self): data = { 'username': '******', 'password': self.password } view = HomeFormView.as_view() request = self.request_factory.post( reverse('home'), data ) request.user = self.user setattr(request, 'session', self.session) response = view(request) self.assertEqual(response.status_code, 302)
def test_home_form_login_fail(self): data = { 'username': '******', 'password': '******' } view = HomeFormView.as_view() request = self.request_factory.post( reverse('home'), data ) request.user = self.user setattr(request, 'session', self.session) setattr(request, '_messages', FallbackStorage(request)) response = view(request) self.assertEqual(response.status_code, 200)
from django.conf.urls import patterns, include, url from apps.sp.views.website.Home import HomeFormView from apps.sp.views.website.Home import LoginAuthView from apps.sp.views.website.Home import LogoutView from apps.sp.views.website.Home import RecoverPasswordFormView from apps.sp.views.website.Home import RegisterUser from apps.sp.views.website.Home import LoginMobile from apps.sp.views.panel.Email import EmailListView urlpatterns = patterns( '', url(r'^$', HomeFormView.as_view(), name='home'), url(r'^login/$', LoginAuthView.as_view(), name='login'), url(r'^login-mobil/$', LoginMobile.as_view(), name='login_mobile'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^register/$', RegisterUser.as_view(), name='register_user'), url(r'^email/$', EmailListView.as_view(), name='email_list'), url(r'^recover/$', RecoverPasswordFormView.as_view(), name='recover_password'))
from django.conf.urls import patterns, include, url from apps.sp.views.website.Home import HomeFormView from apps.sp.views.website.Home import LoginAuthView from apps.sp.views.website.Home import LogoutView from apps.sp.views.website.Home import RecoverPasswordFormView from apps.sp.views.website.Home import RegisterUser from apps.sp.views.website.Home import LoginMobile from apps.sp.views.panel.Email import EmailListView urlpatterns = patterns('', url(r'^$', HomeFormView.as_view(), name='home'), url(r'^login/$', LoginAuthView.as_view(), name='login'), url(r'^login-mobil/$', LoginMobile.as_view(), name='login_mobile'), url(r'^logout/$', LogoutView.as_view(), name='logout'), url(r'^register/$', RegisterUser.as_view(), name='register_user'), url(r'^email/$',