def test_view(self):
     req = RequestFactory().get('/')
     req.GET = {'pk': 1, }
     resp = GetCTypeDetails.as_view()(req)
     ctype = ContentType.objects.get(pk=1)
     self.assertTrue(ctype.app_label in resp.content, msg=(
         'Should return a JSON string containing app_label and model'))
Example #2
0
"""URLs for the ``hero_slider`` app."""
from django.conf.urls.defaults import patterns, url

from hero_slider.views import GetCTypeDetails


urlpatterns = patterns(
    '',
    url(r'ctype/$', GetCTypeDetails.as_view(), name='get_ctype_details'),
)
 def test_bad_pk(self):
     req = RequestFactory().get('/')
     req.GET = {'pk': 999, }
     self.assertRaises(Http404, GetCTypeDetails.as_view(), req)