Ejemplo n.º 1
0
 def test_call_template_with_error_and_debug_disabled(self):
     Page.objects.create(slug="buggy-template",
                         template_name="buggy-template.html")
     response = self.client.get(page_reverse("buggy-template"))
     self.assertStatusCode(
         response,
         404)  # original error is 404 because we dont map pages urls
Ejemplo n.º 2
0
def page_url(slug):
    return page_reverse(slug)
Ejemplo n.º 3
0
 def test_reraise_when_calling_template_with_error_and_debug_enabled(self):
     Page.objects.create(slug="buggy-template", template_name="buggy-template.html")
     url = page_reverse("buggy-template")
     with self.assertRaises(NoReverseMatch):
         self.client.get(url)
Ejemplo n.º 4
0
 def test_call_template_with_error_and_debug_disabled(self):
     Page.objects.create(slug="buggy-template", template_name="buggy-template.html")
     response = self.client.get(page_reverse("buggy-template"))
     self.assertStatusCode(response, 404)  # original error is 404 because we dont map pages urls
Ejemplo n.º 5
0
 def test_fail_reverse_invalid_url(self):
     with self.assertRaises(NoReverseMatch):
         page_reverse("/")
Ejemplo n.º 6
0
 def test_fail_reverse_missing_page(self):
     with self.assertRaises(NoReverseMatch):
         page_reverse("unknown")
Ejemplo n.º 7
0
 def test_success_reverse(self):
     Page.objects.create(slug="about", template_name="about.html")
     url = page_reverse("about")
     self.assertEquals("/about/", url)
Ejemplo n.º 8
0
 def test_reraise_when_calling_template_with_error_and_debug_enabled(self):
     Page.objects.create(slug="buggy-template",
                         template_name="buggy-template.html")
     url = page_reverse("buggy-template")
     with self.assertRaises(NoReverseMatch):
         self.client.get(url)
Ejemplo n.º 9
0
 def test_fail_reverse_invalid_url(self):
     with self.assertRaises(NoReverseMatch):
         page_reverse("/")
Ejemplo n.º 10
0
 def test_fail_reverse_missing_page(self):
     with self.assertRaises(NoReverseMatch):
         page_reverse("unknown")
Ejemplo n.º 11
0
 def test_success_reverse(self):
     Page.objects.create(slug="about", template_name="about.html")
     url = page_reverse("about")
     self.assertEquals("/about/", url)
Ejemplo n.º 12
0
def page_url(slug):
    return page_reverse(slug)