Ejemplo n.º 1
0
 def testBadUrlPath(self):
     """ should raise a 404 if staticwrap exists, but path doesn't exist """
     StaticWrap.objects.create(title="test",
             url_path="testdata/foo",
             originating_site=self.site,
             metadata='{"category_slug": "foo-slug"}',
         )
     with self.assertRaises(Http404):
         render_content(self.request, 'testdata/foo')
Ejemplo n.º 2
0
    def testRenderContentView(self):
        """ test staticwraps.views.render_content """

        result = render_content(self.request, 'testdata/blog')
        self.assertIn('My HTML Content', str(result))
        self.assertIn('name="category_slug" content="opinion-blogs"', str(result))
        self.assertIn('name="title" content="test"', str(result))
Ejemplo n.º 3
0
    def testCleanHtmlContent(self):
        """ make sure the stuff we don't want is gone """

        result = render_content(self.request, 'testdata/blog')
        self.assertNotIn('<head>FOO</head>', str(result))
        self.assertNotIn('<!--#echo var="SITENAME_GENNI"-->', str(result))
Ejemplo n.º 4
0
 def testNoStaticWrap(self):
     """ should raise a 404 if matching staticwrap doesn't exist """
     with self.assertRaises(Http404):
         render_content(self.request, 'testdata/foo')