예제 #1
0
 def test_data_list(self):
     """
     Tests List
     """
     self.insert_test_data()
     view = ClientDataListView.as_view()
     request = self.request_factory.get(reverse("client_data_list"))
     request.user = self.user
     response = view(request)
     self.assertEqual(response.status_code, 200)
     content = json.loads(response._container[0])
     self.assertEqual(len(content.get("client")), 3)
     client = Client()
     client.name = "Client Test"
     client.ruc = "2345654321"
     client.address = "Direccion"
     client.save()
     response = view(request)
     content = json.loads(response._container[0])
     self.assertEqual(len(content.get("client")), 4)
예제 #2
0
 def test_data_list(self):
     """
     Tests List
     """
     self.insert_test_data()
     view = ClientDataListView.as_view()
     request = self.request_factory.get(reverse('client_data_list'))
     request.user = self.user
     response = view(request)
     self.assertEqual(response.status_code, 200)
     content = json.loads(response._container[0])
     self.assertEqual(len(content.get('client')), 3)
     client = Client()
     client.name = 'Client Test'
     client.ruc = '2345654321'
     client.address = 'Direccion'
     client.save()
     response = view(request)
     content = json.loads(response._container[0])
     self.assertEqual(len(content.get('client')), 4)
예제 #3
0
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')
                       )
예제 #4
0
# -*- 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'))