示例#1
0
 def test_get(self):
     request = RequestFactory().get(reverse_lazy("demoperson_list"))
     view = DemopersonListView.as_view(template_name="demoperson_list.html")
     response = view(request)
     self.assertEqual(response.status_code, 200)
     json_request = RequestFactory().get(reverse_lazy("demoperson_list") + "?format=json")
     json_response = view(json_request)
     self.assertEqual(json_response.status_code, 200)
     xml_request = RequestFactory().get(reverse_lazy("demoperson_list") + "?format=xml")
     xml_response = view(xml_request)
     self.assertEqual(xml_response.status_code, 200)
示例#2
0
    DemopersonchildrenCreateView,
    DemopersonchildrenUpdateView,
    DemopersonchildrenDeleteView,
    
)

urlpatterns = patterns(
    '',

    url(r'^demopersonsiblings/$', DemopersonsiblingsListView.as_view(), name="demopersonsiblings_list"),
    url(r'^demopersonsiblings/(?P<pk>\d+)$', DemopersonsiblingsDetailView.as_view(), name="demopersonsiblings_detail"),
    url(r'^demopersonsiblings/create/$', DemopersonsiblingsCreateView.as_view(), name="demopersonsiblings_create"),
    url(r'^demopersonsiblings/update/(?P<pk>\d+)$', DemopersonsiblingsUpdateView.as_view(), name="demopersonsiblings_update"),
    url(r'^demopersonsiblings/delete/(?P<pk>\d+)$', DemopersonsiblingsDeleteView.as_view(), name="demopersonsiblings_delete"),

    url(r'^demoperson/$', DemopersonListView.as_view(), name="demoperson_list"),
    url(r'^demoperson/(?P<pk>\d+)$', DemopersonDetailView.as_view(), name="demoperson_detail"),
    url(r'^demoperson/create/$', DemopersonCreateView.as_view(), name="demoperson_create"),
    url(r'^demoperson/update/(?P<pk>\d+)$', DemopersonUpdateView.as_view(), name="demoperson_update"),
    url(r'^demoperson/delete/(?P<pk>\d+)$', DemopersonDeleteView.as_view(), name="demoperson_delete"),

    url(r'^demopersonparents/$', DemopersonparentsListView.as_view(), name="demopersonparents_list"),
    url(r'^demopersonparents/(?P<pk>\d+)$', DemopersonparentsDetailView.as_view(), name="demopersonparents_detail"),
    url(r'^demopersonparents/create/$', DemopersonparentsCreateView.as_view(), name="demopersonparents_create"),
    url(r'^demopersonparents/update/(?P<pk>\d+)$', DemopersonparentsUpdateView.as_view(), name="demopersonparents_update"),
    url(r'^demopersonparents/delete/(?P<pk>\d+)$', DemopersonparentsDeleteView.as_view(), name="demopersonparents_delete"),

    url(r'^demofamilypets/$', DemofamilypetsListView.as_view(), name="demofamilypets_list"),
    url(r'^demofamilypets/(?P<pk>\d+)$', DemofamilypetsDetailView.as_view(), name="demofamilypets_detail"),
    url(r'^demofamilypets/create/$', DemofamilypetsCreateView.as_view(), name="demofamilypets_create"),
    url(r'^demofamilypets/update/(?P<pk>\d+)$', DemofamilypetsUpdateView.as_view(), name="demofamilypets_update"),
示例#3
0
 def test_post(self):
     request = RequestFactory().post(reverse_lazy("demoperson_list"))
     view = DemopersonListView.as_view(template_name="demoperson_list.html")
     response = view(request)
     self.assertEqual(response.status_code, 405)