def test_update_Group(self): group = Group.objects.get(pk=1) self.assertEqual(group.permissions.all().count(), 0) data = { 'pk': group.id, 'name': 'groupTestUpdate', 'permission1': Permission.objects.get(pk=1).id, 'permission2': Permission.objects.get(pk=2).id, 'permission3': Permission.objects.get(pk=3).id } url_kwargs = {'pk': group.id} view = AdminGroupEditView.as_view() request = self.request_factory.post( reverse('admin_group_edit', kwargs=url_kwargs), data) request.user = self.user response = view(request, **data) self.assertEqual(response.status_code, 302) self.assertEqual(Group.objects.all().count(), 2) group = Group.objects.get(name='groupTestUpdate') self.assertEqual(group.permissions.all().count(), 3)
def test_update_Group(self): group = Group.objects.get(pk=1) self.assertEqual(group.permissions.all().count(), 0) data = { 'pk': group.id, 'name': 'groupTestUpdate', 'permission1': Permission.objects.get(pk=1).id, 'permission2': Permission.objects.get(pk=2).id, 'permission3': Permission.objects.get(pk=3).id } url_kwargs = {'pk': group.id} view = AdminGroupEditView.as_view() request = self.request_factory.post( reverse('admin_group_edit', kwargs=url_kwargs), data ) request.user = self.user response = view(request, **data) self.assertEqual(response.status_code, 302) self.assertEqual(Group.objects.all().count(), 2) group = Group.objects.get(name='groupTestUpdate') self.assertEqual(group.permissions.all().count(), 3)
from apps.sp.views.panel.Dashboard import SettingsTemplateView urlpatterns = patterns( '', url(r'^settings/$', SettingsTemplateView.as_view(), name='admin_settings'), #Group url(r'^group/list/$', AdminGroupListView.as_view(), name='admin_group_list'), url(r'^group/create/$', AdminGroupCreateView.as_view(), name='admin_group_create'), url(r'^group/edit/(?P<pk>\d+)/$', AdminGroupEditView.as_view(), name='admin_group_edit'), url(r'^group/delete/$', AdminGroupDeleteView.as_view(), name='admin_group_delete'), #User url(r'^user/list/$', AdminUserListView.as_view(), name='admin_user_list'), url(r'^user/list/create/$', AdminUserCreateView.as_view(), name='admin_user_create'), url(r'^user/list/edit/(?P<pk>\d+)/$', AdminUserUpdateView.as_view(), name='admin_user_update'), url(r'^user/list/edit/(?P<pk>\d+)/status/$', AdminUserChangeStatusRedirectView.as_view(),
urlpatterns = patterns('', url(r'^settings/$', SettingsTemplateView.as_view(), name='admin_settings'), #Group url(r'^group/list/$', AdminGroupListView.as_view(), name='admin_group_list'), url(r'^group/create/$', AdminGroupCreateView.as_view(), name='admin_group_create'), url(r'^group/edit/(?P<pk>\d+)/$', AdminGroupEditView.as_view(), name='admin_group_edit'), url(r'^group/delete/$', AdminGroupDeleteView.as_view(), name='admin_group_delete'), #User url(r'^user/list/$', AdminUserListView.as_view(), name='admin_user_list'), url(r'^user/list/create/$', AdminUserCreateView.as_view(), name='admin_user_create'),