def test_clean_title_instance(self):
     """
     Should clean the title with instance
     """
     form = EtherpadForm(group=self.group, data=self.data, instance=self.pad)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.forms['obj'].clean_title(), self.pad.title)
示例#2
0
 def test_clean_title(self):
     """
     Should clean the title
     """
     form = EtherpadForm(group=self.group, data=self.data)
     self.assertTrue(form.is_valid())
     self.assertEqual(form.forms['obj'].clean_title(),
                      form.forms['obj'].cleaned_data['title'])
示例#3
0
 def test_readonly_title(self):
     """
     Should not set the title to readonly in the widget if instance is not
     given
     """
     form = EtherpadForm(group=self.group).forms['obj']
     self.assertNotIn('readonly', form.fields['title'].widget.attrs)
示例#4
0
 def test_readonly_title_instance(self):
     """
     Should set the title to readonly in the widget if instance is given
     """
     form = EtherpadForm(group=self.group, instance=self.pad).forms['obj']
     self.assertTrue(form.fields['title'].widget.attrs['readonly'])