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())
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)
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())
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())
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)