def test_confirm_preprint_as_spam(self): assert self.preprint.is_public view = views.PreprintConfirmSpamView() view = setup_log_view(view, self.request, guid=self.preprint._id) view.delete(self.request) self.preprint.refresh_from_db() assert self.preprint.spam_status == 2 assert not self.preprint.is_public
def test_confirm_preprint_as_spam(self, mock_akismet): request = RequestFactory().post('/fake_path') user = AuthUserFactory() preprint = PreprintFactory(creator=user) assert preprint.is_public view = views.PreprintConfirmSpamView() view = setup_log_view(view, request, guid=preprint._id) view.post(request) preprint.refresh_from_db() assert preprint.spam_status == 2 assert not preprint.is_public
def test_confirm_spam(self, flagged_preprint, superuser, mock_akismet): request = RequestFactory().post('/fake_path') request.user = superuser view = views.PreprintConfirmSpamView() view = setup_view(view, request, guid=flagged_preprint._id) view.post(request) assert flagged_preprint.is_public flagged_preprint.refresh_from_db() assert flagged_preprint.is_spam assert flagged_preprint.is_spam assert not flagged_preprint.is_public