def test_list_view_entry_filter(self): self.insert_test_data() request = self.request_factory.get( reverse('entry_list'), data={'name__icontains': 'Telefonia'}) request.user = self.user view = EntryListView.as_view() response = view(request) self.assertEquals(response.status_code, 200) self.assertEquals(len(response.context_data['object_list']), 1)
def test_list_view_entry_filter(self): self.insert_test_data() request = self.request_factory.get(reverse('entry_list'), data={'name__icontains': 'Telefonia'} ) request.user = self.user view = EntryListView.as_view() response = view(request) self.assertEquals(response.status_code, 200) self.assertEquals(len(response.context_data['object_list']), 1)
def test_list_view_entry(self): self.insert_test_data() view = EntryListView.as_view() request = self.request_factory.get(reverse('entry_list')) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200) self.assertEqual(response.context_data['object_list'].count(), 5) entry = Entry() entry.name = 'Entry test' entry.save() response = view(request) self.assertEqual(response.context_data['object_list'].count(), 6)
def test_list_view_entry(self): self.insert_test_data() view = EntryListView.as_view() request = self.request_factory.get( reverse('entry_list') ) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200) self.assertEqual(response.context_data['object_list'].count(), 5) entry = Entry() entry.name = 'Entry test' entry.save() response = view(request) self.assertEqual(response.context_data['object_list'].count(), 6)
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from apps.sp.views.panel.Entry import EntryListView, \ EntryCreateView, EntryUpdateView, EntryDeleteView, \ EntryDataListView urlpatterns = patterns( '', #Entry url(r'^list/$', EntryListView.as_view(), name='entry_list'), url(r'^create/$', EntryCreateView.as_view(), name='entry_create'), url(r'^edit/(?P<pk>\d+)/$', EntryUpdateView.as_view(), name='entry_edit'), url(r'^delete/(?P<pk>\d+)/$', EntryDeleteView.as_view(), name='entry_delete'), url(r'^data-list/$', EntryDataListView.as_view(), name='entry_data_list'), )
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from apps.sp.views.panel.Entry import EntryListView, \ EntryCreateView, EntryUpdateView, EntryDeleteView, \ EntryDataListView urlpatterns = patterns('', #Entry url(r'^list/$', EntryListView.as_view(), name='entry_list'), url(r'^create/$', EntryCreateView.as_view(), name='entry_create'), url(r'^edit/(?P<pk>\d+)/$', EntryUpdateView.as_view(), name='entry_edit'), url(r'^delete/(?P<pk>\d+)/$', EntryDeleteView.as_view(), name='entry_delete'), url(r'^data-list/$', EntryDataListView.as_view(), name='entry_data_list'), )