Ejemplo n.º 1
0
 def test_confirm_ham(self):
     form_data = {"confirm": str(Comment.HAM)}
     form = ConfirmForm(data=form_data)
     nt.assert_true(form.is_valid())
     view = SpamDetail()
     view = setup_form_view(view, self.request, form, spam_id=self.comment._id)
     with transaction.atomic():
         view.form_valid(form)
     obj = OSFLogEntry.objects.latest(field_name="action_time")
     nt.assert_equal(obj.object_id, self.comment._id)
     nt.assert_in("Confirmed HAM:", obj.message())
Ejemplo n.º 2
0
 def test_add_log(self, mock_success_url):
     form_data = {'confirm': '2'}
     form = ConfirmForm(data=form_data)
     nt.assert_true(form.is_valid())
     view = SpamDetail()
     view = setup_form_view(
         view, self.request, form, spam_id=self.comment._id)
     with transaction.atomic():
         view.form_valid(form)
     obj = OSFLogEntry.objects.latest(field_name='action_time')
     nt.assert_equal(obj.object_id, self.comment._id)
Ejemplo n.º 3
0
 def test_confirm_spam(self):
     form_data = {'confirm': str(SpamStatus.SPAM)}
     form = ConfirmForm(data=form_data)
     nt.assert_true(form.is_valid())
     view = SpamDetail()
     view = setup_form_view(
         view, self.request, form, spam_id=self.comment._id)
     with transaction.atomic():
         view.form_valid(form)
     obj = AdminLogEntry.objects.latest(field_name='action_time')
     nt.assert_equal(obj.object_id, self.comment._id)
     nt.assert_in('Confirmed SPAM:', obj.message())
Ejemplo n.º 4
0
 def test_confirm_ham(self):
     form_data = {'confirm': str(SpamStatus.HAM)}
     form = ConfirmForm(data=form_data)
     nt.assert_true(form.is_valid())
     view = SpamDetail()
     view = setup_form_view(
         view, self.request, form, spam_id=self.comment._id)
     with transaction.atomic():
         view.form_valid(form)
     obj = OSFLogEntry.objects.latest(field_name='action_time')
     nt.assert_equal(obj.object_id, self.comment._id)
     nt.assert_in('Confirmed HAM:', obj.message())
Ejemplo n.º 5
0
 def test_add_log(self, mock_success_url):
     form_data = {'confirm': '2'}
     form = ConfirmForm(data=form_data)
     nt.assert_true(form.is_valid())
     view = SpamDetail()
     view = setup_form_view(view,
                            self.request,
                            form,
                            spam_id=self.comment._id)
     with transaction.atomic():
         view.form_valid(form)
     obj = OSFLogEntry.objects.latest(field_name='action_time')
     nt.assert_equal(obj.object_id, self.comment._id)