Esempio n. 1
0
 def testHtmlPageForm(self):
     from djpcms.apps.contentedit import HtmlPageForm
     from djpcms.html.layout import grid
     l = HtmlPageForm['layout']
     self.assertTrue(l)
     # the columns are the second child (first is the message holder)
     columns = l.children[1]
     self.assertEqual(len(columns.children), 2)
     self.assertEqual(columns.grid, grid('grid 50-50'))
     w = HtmlPageForm()
     text = w.render()
     self.assertTrue(text)
Esempio n. 2
0
 def testHtmlPageForm(self):
     from djpcms.apps.contentedit import HtmlPageForm
     from djpcms.html.layout import grid
     l = HtmlPageForm['layout']
     self.assertTrue(l)
     # the columns are the second child (first is the message holder)
     columns = l.children[1]
     self.assertEqual(len(columns.children), 2)
     self.assertEqual(columns.grid, grid('grid 50-50'))
     w = HtmlPageForm()
     text = w.render()
     self.assertTrue(text)
Esempio n. 3
0
 def testInitialPageForm(self):
     '''Test the Page Form'''
     from djpcms.apps.contentedit import HtmlPageForm
     d = dict(HtmlPageForm.form_class.initials())
     self.assertTrue(d)
     ph = HtmlPageForm()
     p = ph.form
     self.assertFalse(p.is_bound)
     initial = p.initial
     self.assertEqual(initial['in_navigation'], 0)
     self.assertEqual(d, initial)
Esempio n. 4
0
    def testPageFormBound(self):
        from djpcms.apps.contentedit import HtmlPageForm
        from stdcms.cms.models import Page
        from stdnet import odm
        d = self.page_data()
        p = HtmlPageForm(data=d)
        form = p.form
        self.assertFalse(p.is_valid())
        p = HtmlPageForm(data=d, model=Page)
        self.assertTrue(p.is_valid())
        page = p.form.save()
        page = Page.objects.get(id=page.id)
        for k, v in d.items():
            self.assertEqual(getattr(page, k), v)
        p = HtmlPageForm(instance=page)
        dp = p.form.initial
        for k, v in d.items():
            self.assertEqual(dp[k], v)

        # Now we test the rendered form
        w = p.addAttr('action', '/test/')
        html = w.render()
        self.assertTrue('value="0"' in html)
Esempio n. 5
0
 def testPageFormBound(self):
     from djpcms.apps.contentedit import HtmlPageForm
     from stdcms.cms.models import Page
     from stdnet import odm
     d = self.page_data()
     p = HtmlPageForm(data=d)
     form = p.form
     self.assertFalse(p.is_valid())
     p = HtmlPageForm(data=d, model=Page)
     self.assertTrue(p.is_valid())
     page = p.form.save()
     page = Page.objects.get(id = page.id)
     for k,v in d.items():
         self.assertEqual(getattr(page,k),v)
     p = HtmlPageForm(instance = page)
     dp = p.form.initial
     for k,v in d.items():
         self.assertEqual(dp[k],v)
         
     # Now we test the rendered form
     w = p.addAttr('action','/test/')
     html = w.render()
     self.assertTrue('value="0"' in html)