Exemplo n.º 1
0
 def test_get(self):
     request = RequestFactory().get(reverse_lazy("demopet_list"))
     view = DemopetListView.as_view(template_name="demopet_list.html")
     response = view(request)
     self.assertEqual(response.status_code, 200)
     json_request = RequestFactory().get(reverse_lazy("demopet_list") + "?format=json")
     json_response = view(json_request)
     self.assertEqual(json_response.status_code, 200)
     xml_request = RequestFactory().get(reverse_lazy("demopet_list") + "?format=xml")
     xml_response = view(xml_request)
     self.assertEqual(xml_response.status_code, 200)
Exemplo n.º 2
0
    url(r'^demofamilypets/create/$', DemofamilypetsCreateView.as_view(), name="demofamilypets_create"),
    url(r'^demofamilypets/update/(?P<pk>\d+)$', DemofamilypetsUpdateView.as_view(), name="demofamilypets_update"),
    url(r'^demofamilypets/delete/(?P<pk>\d+)$', DemofamilypetsDeleteView.as_view(), name="demofamilypets_delete"),

    url(r'^demofamily/$', DemofamilyListView.as_view(), name="demofamily_list"),
    url(r'^demofamily/(?P<pk>\d+)$', DemofamilyDetailView.as_view(), name="demofamily_detail"),
    url(r'^demofamily/create/$', DemofamilyCreateView.as_view(), name="demofamily_create"),
    url(r'^demofamily/update/(?P<pk>\d+)$', DemofamilyUpdateView.as_view(), name="demofamily_update"),
    url(r'^demofamily/delete/(?P<pk>\d+)$', DemofamilyDeleteView.as_view(), name="demofamily_delete"),

    url(r'^demofamilymembers/$', DemofamilymembersListView.as_view(), name="demofamilymembers_list"),
    url(r'^demofamilymembers/(?P<pk>\d+)$', DemofamilymembersDetailView.as_view(), name="demofamilymembers_detail"),
    url(r'^demofamilymembers/create/$', DemofamilymembersCreateView.as_view(), name="demofamilymembers_create"),
    url(r'^demofamilymembers/update/(?P<pk>\d+)$', DemofamilymembersUpdateView.as_view(), name="demofamilymembers_update"),
    url(r'^demofamilymembers/delete/(?P<pk>\d+)$', DemofamilymembersDeleteView.as_view(), name="demofamilymembers_delete"),

    url(r'^demopet/$', DemopetListView.as_view(), name="demopet_list"),
    url(r'^demopet/(?P<pk>\d+)$', DemopetDetailView.as_view(), name="demopet_detail"),
    url(r'^demopet/create/$', DemopetCreateView.as_view(), name="demopet_create"),
    url(r'^demopet/update/(?P<pk>\d+)$', DemopetUpdateView.as_view(), name="demopet_update"),
    url(r'^demopet/delete/(?P<pk>\d+)$', DemopetDeleteView.as_view(), name="demopet_delete"),

    url(r'^demopersonchildren/$', DemopersonchildrenListView.as_view(), name="demopersonchildren_list"),
    url(r'^demopersonchildren/(?P<pk>\d+)$', DemopersonchildrenDetailView.as_view(), name="demopersonchildren_detail"),
    url(r'^demopersonchildren/create/$', DemopersonchildrenCreateView.as_view(), name="demopersonchildren_create"),
    url(r'^demopersonchildren/update/(?P<pk>\d+)$', DemopersonchildrenUpdateView.as_view(), name="demopersonchildren_update"),
    url(r'^demopersonchildren/delete/(?P<pk>\d+)$', DemopersonchildrenDeleteView.as_view(), name="demopersonchildren_delete"),

)

Exemplo n.º 3
0
 def test_post(self):
     request = RequestFactory().post(reverse_lazy("demopet_list"))
     view = DemopetListView.as_view(template_name="demopet_list.html")
     response = view(request)
     self.assertEqual(response.status_code, 405)