aboutsummaryrefslogtreecommitdiff
path: root/apps/pages/tests/test_models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2018-12-06 06:59:25 -0600
committerluxagraf <sng@luxagraf.net>2018-12-06 06:59:25 -0600
commitcb21e59587ab328e9a3e06c9d57c2bafce281715 (patch)
treeca98741b686ce3e00c0e001caedf51683b921a0c /apps/pages/tests/test_models.py
parentd45fa99aa9d587b5674484f68955b43f39e8f6fd (diff)
restructed notes urls, added more tests
Diffstat (limited to 'apps/pages/tests/test_models.py')
-rw-r--r--apps/pages/tests/test_models.py36
1 files changed, 26 insertions, 10 deletions
diff --git a/apps/pages/tests/test_models.py b/apps/pages/tests/test_models.py
index f8de5c7..2722430 100644
--- a/apps/pages/tests/test_models.py
+++ b/apps/pages/tests/test_models.py
@@ -4,17 +4,33 @@ from pages.models import Page
class PageModelTest(TestCase):
-
- def test_string_representation(self):
- page = Page(
+ def setUp(self):
+ self.page = Page(
title="Test Page",
meta_description="The meta desc",
body_markdown="the body of the page",
)
- page.save()
- self.assertEqual(str(page), "Test Page")
- self.assertEqual(str(page.slug), "test-page")
- self.assertEqual(str(page.body_markdown), "the body of the page")
- self.assertEqual(str(page.body_html), "<p>the body of the page</p>")
- self.assertEqual(str(page.meta_description), "The meta desc")
- self.assertEqual(page.path, None)
+ self.page.save()
+ self.pathpage = Page(
+ title="Test Page",
+ meta_description="The meta desc",
+ body_markdown="the body of the page",
+ path="test-path",
+ )
+ self.pathpage.save()
+
+ def test_string_representation(self):
+ self.assertEqual(str(self.page), "Test Page")
+ self.assertEqual(str(self.page.slug), "test-page")
+ self.assertEqual(str(self.page.body_markdown), "the body of the page")
+ self.assertEqual(str(self.page.body_html), "<p>the body of the page</p>")
+ self.assertEqual(str(self.page.meta_description), "The meta desc")
+ self.assertEqual(self.page.path, None)
+
+ def test_get_absolute_url(self):
+ """Absolute URL should return /page """
+ self.assertEqual(str(self.page.get_absolute_url()), "/test-page")
+
+ def test_path_get_absolute_url(self):
+ """Absolute URL with a path should return /path/page """
+ self.assertEqual(str(self.pathpage.get_absolute_url()), "/test-path/test-page")