Exemplo n.º 1
0
    def test_assign_group_user(self):
        """
        Tests data: Update
        """
        user_group = self.user.groups.all()
        self.assertEqual(user_group.count(), 0)
        request = self.request_factory.get(
            reverse('admin_user_group_detail', kwargs={'pk': self.user.id}))
        request.user = self.user
        view = AdminUserDetailView.as_view()
        response = view(request, pk=self.user.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(user_group.count(), 0)
        #Post
        data = {'pk': self.user.id, 'group': Group.objects.get(pk=1).id}

        url_kwargs = {'pk': self.user.id}
        url = reverse('admin_user_group_detail', kwargs=url_kwargs)
        request = self.request_factory.post(url, data=data)
        request.user = self.user
        view = AdminUserDetailView.as_view()
        response = view(request, **data)

        user = User.objects.get(is_superuser=True)
        user_group = user.groups.all()
        self.assertEqual(user_group.count(), 1)
        self.assertEqual(response.status_code, 302)
Exemplo n.º 2
0
    def test_assign_group_user(self):
        """
        Tests data: Update
        """
        user_group = self.user.groups.all()
        self.assertEqual(user_group.count(), 0)
        request = self.request_factory.get(reverse('admin_user_group_detail',
                                                   kwargs={'pk': self.user.id}))
        request.user = self.user
        view = AdminUserDetailView.as_view()
        response = view(request, pk=self.user.id)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(user_group.count(), 0)
        #Post
        data = {
            'pk': self.user.id,
            'group': Group.objects.get(pk=1).id
        }

        url_kwargs = {'pk': self.user.id}
        url = reverse('admin_user_group_detail', kwargs=url_kwargs)
        request = self.request_factory.post(url, data=data)
        request.user = self.user
        view = AdminUserDetailView.as_view()
        response = view(request, **data)

        user = User.objects.get(is_superuser=True)
        user_group = user.groups.all()
        self.assertEqual(user_group.count(), 1)
        self.assertEqual(response.status_code, 302)
Exemplo n.º 3
0
        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(),
        name='admin_user_change_status'),
    url(r'^user/(?P<pk>\d+)/detail/group/$',
        AdminUserDetailView.as_view(),
        name='admin_user_group_detail'),
    url(r'^user/(?P<pk>\d+)/detail/permission/$',
        AdminUserPermissionDetailView.as_view(),
        name='admin_user_permission_detail'),
    url(r'^user/(?P<pk>\d+)/detail/group/delete/$',
        AdminUserGroupDeleteView.as_view(),
        name='admin_user_group_delete'),

    #Support
    url(r'^user/support/$',
        AdminSupportListView.as_view(),
        name='admin_user_support_list'),
    url(r'^user/support/save/$',
        AdminSupportReportView.as_view(),
        name='admin_user_support_save'),
Exemplo n.º 4
0

                       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(),
                           name='admin_user_change_status'),

                       url(r'^user/(?P<pk>\d+)/detail/group/$',
                           AdminUserDetailView.as_view(),
                           name='admin_user_group_detail'),

                       url(r'^user/(?P<pk>\d+)/detail/permission/$',
                           AdminUserPermissionDetailView.as_view(),
                           name='admin_user_permission_detail'),

                       url(r'^user/(?P<pk>\d+)/detail/group/delete/$',
                           AdminUserGroupDeleteView.as_view(),
                           name='admin_user_group_delete'),

                    #Support
                       url(r'^user/support/$',
                           AdminSupportListView.as_view(),
                           name='admin_user_support_list'),