def test_delete_view_brand(self): """ Tests data: Delete """ self.insert_test_data() self.assertEqual(Client.objects.all().count(), 3) brand = Client.objects.get(pk=1) kwargs = {"pk": brand.id} url = reverse("brand_delete", kwargs=kwargs) request = self.request_factory.post(url, kwargs) request.user = self.user response = ClientDeleteView.as_view()(request, **kwargs) self.assertEqual(response.status_code, 302) self.assertEqual(Client.objects.all().count(), 2)
def test_delete_view_brand(self): """ Tests data: Delete """ self.insert_test_data() self.assertEqual(Client.objects.all().count(), 3) brand = Client.objects.get(pk=1) kwargs = {'pk': brand.id} url = reverse('brand_delete', kwargs=kwargs) request = self.request_factory.post(url, kwargs) request.user = self.user response = ClientDeleteView.as_view()(request, **kwargs) self.assertEqual(response.status_code, 302) self.assertEqual(Client.objects.all().count(), 2)
from django.conf.urls import url, patterns from apps.sp.views.panel.Client import ClientListView, ClientCreateView, \ ClientUpdateView, ClientDeleteView, ClientDataListView, \ TypeClientDataListView, ClientCreateDataJson urlpatterns = patterns('', #Client url(r'^list/$', ClientListView.as_view(), name='client_list'), url(r'^create/$', ClientCreateView.as_view(), name='client_create'), url(r'^edit/(?P<pk>\d+)/$', ClientUpdateView.as_view(), name='client_edit'), url(r'^delete/(?P<pk>\d+)/$', ClientDeleteView.as_view(), name='client_delete'), url(r'^data-list/$', ClientDataListView.as_view(), name='client_data_list'), url(r'^type-data-list/$', TypeClientDataListView.as_view(), name='type_client_data_list'), url(r'^json-create/$', ClientCreateDataJson.as_view(), name='client_json_create') )
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from apps.sp.views.panel.Client import ClientListView, ClientCreateView, \ ClientUpdateView, ClientDeleteView, ClientDataListView, \ TypeClientDataListView, ClientCreateDataJson urlpatterns = patterns( '', #Client url(r'^list/$', ClientListView.as_view(), name='client_list'), url(r'^create/$', ClientCreateView.as_view(), name='client_create'), url(r'^edit/(?P<pk>\d+)/$', ClientUpdateView.as_view(), name='client_edit'), url(r'^delete/(?P<pk>\d+)/$', ClientDeleteView.as_view(), name='client_delete'), url(r'^data-list/$', ClientDataListView.as_view(), name='client_data_list'), url(r'^type-data-list/$', TypeClientDataListView.as_view(), name='type_client_data_list'), url(r'^json-create/$', ClientCreateDataJson.as_view(), name='client_json_create'))