Ejemplo n.º 1
0
 def test_create_draft(self):
     form = EditDraftForm(self.user, {
         'type': Post.TYPE_POST,
     })
     self.assertTrue(form.is_valid(), msg='draft validation failed')
     draft = form.save()
     self.assertIsNotNone(draft.id, msg='draft saving not work')
Ejemplo n.º 2
0
 def test_create_draft(self):
     form = EditDraftForm(self.user, {
         'type': Post.TYPE_POST,
     })
     self.assertTrue(form.is_valid(), msg='draft validation failed')
     draft = form.save()
     self.assertIsNotNone(draft.id, msg='draft saving not work')
Ejemplo n.º 3
0
 def test_edit_draft(self):
     draft = Draft.objects.create(
         title='okok',
         author=self.user,
         type=Post.TYPE_POST,
     )
     form = EditDraftForm(self.user, {
         'title': 'yee',
         'text': 'okok',
     }, instance=draft)
     form.is_valid()
     self.assertTrue(form.is_valid(), msg='edit draft validation failed')
     changed_draft = form.save()
     self.assertEqual(draft.id, changed_draft.id, msg='new draft created')
     self.assertEqual(changed_draft.title, 'yee', msg='draft edit failed')
Ejemplo n.º 4
0
 def test_edit_draft(self):
     draft = Draft.objects.create(
         title='okok',
         author=self.user,
         type=Post.TYPE_POST,
     )
     form = EditDraftForm(self.user, {
         'title': 'yee',
         'text': 'okok',
     },
                          instance=draft)
     form.is_valid()
     self.assertTrue(form.is_valid(), msg='edit draft validation failed')
     changed_draft = form.save()
     self.assertEqual(draft.id, changed_draft.id, msg='new draft created')
     self.assertEqual(changed_draft.title, 'yee', msg='draft edit failed')