def test_list_view_brand_filter(self): """ Tests data: Filter """ self.insert_test_data() request = self.request_factory.get(reverse('brand_list'), data={'name__icontains': 'Sprite'}) request.user = self.user view = BrandListView.as_view() response = view(request) self.assertEquals(response.status_code, 200) self.assertEquals(len(response.context_data['object_list']), 1)
def test_list_view_brand(self): """ Tests data: List """ self.insert_test_data() view = BrandListView.as_view() request = self.request_factory.get(reverse('brand_list')) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200) self.assertEqual(response.context_data['object_list'].count(), 9) brand = Brand() brand.entry = Entry.objects.latest('id') brand.name = 'Brand Test' brand.save() response = view(request) self.assertEqual(response.context_data['object_list'].count(), 10)
def test_list_view_brand(self): """ Tests data: List """ self.insert_test_data() view = BrandListView.as_view() request = self.request_factory.get( reverse('brand_list') ) request.user = self.user response = view(request) self.assertEqual(response.status_code, 200) self.assertEqual(response.context_data['object_list'].count(), 9) brand = Brand() brand.entry = Entry.objects.latest('id') brand.name = 'Brand Test' brand.save() response = view(request) self.assertEqual(response.context_data['object_list'].count(), 10)
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from apps.sp.views.panel.Brand import BrandListView, BrandCreateView,\ BrandUpdateView, BrandDeleteView, BrandByEntryIdJson urlpatterns = patterns( '', #Brand url(r'^list/$', BrandListView.as_view(), name='brand_list'), url(r'^create/$', BrandCreateView.as_view(), name='brand_create'), url(r'^edit/(?P<pk>\d+)/$', BrandUpdateView.as_view(), name='brand_edit'), url(r'^delete/(?P<pk>\d+)/$', BrandDeleteView.as_view(), name='brand_delete'), url(r'^brand-by-entry/(?P<entry>[^/]+)/$', BrandByEntryIdJson.as_view(), name='brand_by_entry_json'), )
# -*- coding: utf-8 -*- from django.conf.urls import url, patterns from apps.sp.views.panel.Brand import BrandListView, BrandCreateView,\ BrandUpdateView, BrandDeleteView, BrandByEntryIdJson urlpatterns = patterns('', #Brand url(r'^list/$', BrandListView.as_view(), name='brand_list'), url(r'^create/$', BrandCreateView.as_view(), name='brand_create'), url(r'^edit/(?P<pk>\d+)/$', BrandUpdateView.as_view(), name='brand_edit'), url(r'^delete/(?P<pk>\d+)/$', BrandDeleteView.as_view(), name='brand_delete'), url(r'^brand-by-entry/(?P<entry>[^/]+)/$', BrandByEntryIdJson.as_view(), name='brand_by_entry_json'), )