Ejemplo n.º 1
0
 def test_normal_page_renders(self):
     t = Factory.template(content='{{rendered_page_html|safe}}')
     self.page = Factory.page(
         template=t,
     )
     url = reverse('website:page_or_post', kwargs={"page_slug": self.page.slug, },)
     response = self.get(url)
     self.assertEquals(response.status_code, 200)
Ejemplo n.º 2
0
    def test_basic_body_override_page_renders(self):
        t = Factory.template(body_override=Factory.rand_text(), )
        self.page = Factory.page(template=t, )
        rendered = self.page.rendered
        self.assertEquals(
            rendered, """<!doctype html >
<html itemscope itemtype="http://schema.org/CreativeWork" class="%(html_extra_classes)s" lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>%(title)s</title>
    <meta name="description" content="%(description)s">


    <!-- Open Graph data -->
    <meta property="og:title" content="%(title)s" />
    <meta property="og:type" content="article" />
    <meta property="og:url" content="" />
    <meta property="og:image" content="" />
    <meta property="og:description" content="%(description)s" />
    <meta property="og:site_name" content="" />
    <link rel="canonical" href="" />
    <meta property="article:published_time" content="" />
    <meta property="article:modified_time" content="" />
    <meta property="article:section" content="Writing" />
    <meta property="article:tag" content="Writing" />

    <!-- Schema.org markup for Google+ -->
    <meta itemprop="name" content="%(title)s">
    <meta itemprop="description" content="%(description)s">
    <meta itemprop="author" content="">
    <meta itemprop="provider" content="">


    %(css)s


    <script>
        window.inkshop = window.inkshop || {};
        window.inkshop.site_data;
    </script>
    %(inkdots)s
</head>

<body >
    %(body_override)s
    %(js)s
</body>
</html>""" % {
                "title": self.page.title,
                "description": self.page.description,
                "css": self.page.template.css,
                "js": self.page.template.js,
                "html_extra_classes": self.page.template.html_extra_classes,
                "body_override": self.page.template.body_override,
                "inkdots": inkdots_template,
            })
Ejemplo n.º 3
0
 def test_basic_no_frills_page_renders(self):
     t = Factory.template(
         everything_override="This is as basic as it gets.",
     )
     self.page = Factory.page(
         template=t,
     )
     rendered = self.page.rendered
     self.assertEquals(rendered, """This is as basic as it gets.""")
Ejemplo n.º 4
0
 def test_root_page_renders(self):
     t = Factory.template(content='{{rendered_page_html|safe}}')
     self.page = Factory.page(
         template=t,
         root_page=True,
         slug='',
     )
     url = reverse('website:root_page_or_post')
     response = self.get(url)
     self.assertEquals(response.status_code, 200)
Ejemplo n.º 5
0
    def test_full_field_page_renders(self):
        t = Factory.template(content='{{rendered_page_html|safe}}')
        self.page = Factory.page(
            template=t,
        )
        url = reverse('website:page_or_post', kwargs={"page_slug": self.page.slug, },)
        response = self.get(url)
        self.assertEquals(response.status_code, 200)
        resp_content = str(response.content)

        self.assertIn(self.page.title, resp_content)
        self.assertIn(self.page.description, resp_content)
        self.assertIn(self.page.template.nav, resp_content)
        self.assertIn(self.page.source_text, resp_content)
        self.assertIn(self.page.template.footer, resp_content)
        self.assertIn(self.page.template.css, resp_content)
        self.assertIn(self.page.template.html_extra_classes, resp_content)
        self.assertIn(self.page.template.js, resp_content)
        if self.page.template.body_override:
            self.assertIn(self.page.template.body_override, resp_content)
Ejemplo n.º 6
0
 def test_page_renders(self):
     self.page = Factory.page()
     rendered = self.page.rendered
     self.assertNotEquals(self.page, None)
     self.assertNotEquals(rendered, None)