Exemplo n.º 1
0
 def test_form_save(self):
     data = {"moderator": None, "message": "Approved message"}
     form = UpdateModerationRequestForm(
         data,
         action=constants.ACTION_APPROVED,
         language="en",
         page=self.pg1_version,
         user=self.user,
         workflow=self.wf1,
         active_request=self.moderation_request1,
     )
     form.active_request.update_status = mock.MagicMock()
     self.assertTrue(form.is_valid())
     form.save()
     form.active_request.update_status.assert_called_once_with(
         action=constants.ACTION_APPROVED,
         by_user=self.user,
         to_user=None,
         message="Approved message",
     )
 def test_form_save(self):
     data = {'moderator': None, 'message': 'Approved message'}
     form = UpdateModerationRequestForm(
         data,
         action=constants.ACTION_APPROVED,
         language='en',
         page=self.pg1,
         user=self.user,
         workflow=self.wf1,
         active_request=self.moderation_request1,
     )
     form.active_request.update_status = MagicMock()
     self.assertTrue(form.is_valid())
     form.save()
     form.active_request.update_status.assert_called_once_with(
         action=constants.ACTION_APPROVED,
         by_user=self.user,
         to_user=None,
         message='Approved message',
     )