Exemplo n.º 1
0
 def test_get(self):
     request = RequestFactory().get(reverse_lazy("demofamilypets_update", kwargs={"pk": 1}))
     view = DemofamilypetsUpdateView.as_view(template_name="demofamilypets_update.html")
     response = view(request, pk=1)
     self.assertEqual(response.status_code, 200)
     json_request = RequestFactory().get(reverse_lazy("demofamilypets_update", kwargs={"pk": 1}) + "?format=json")
     json_response = view(request, pk=1)
     self.assertEqual(json_response.status_code, 200)
     xml_request = RequestFactory().get(reverse_lazy("demofamilypets_update", kwargs={"pk": 1}) + "?format=xml")
     xml_response = view(xml_request, pk=1)
     self.assertEqual(xml_request.status_code, 200)
Exemplo n.º 2
0
    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"),
    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"),
Exemplo n.º 3
0
 def test_post(self):
     request = RequestFactory().post(reverse_lazy("demofamilypets_update", kwargs={"pk": 1}))
     view = DemofamilypetsUpdateView.as_view(template_name="demofamilypets_update.html")
     response = view(request, pk=1)
     self.assertEqual(response.status_code, 200)