# HG changeset patch # User Brian Neal # Date 1739237654 21600 # Node ID 9a011e2de2f622e533d554e53446d7db78c8eec2 # Parent 5e898f91fe36322df4dfd9c84560bd3d2ff53866 Add more coverage to antispam utils unit tests. diff -r 5e898f91fe36 -r 9a011e2de2f6 antispam/tests/test_utils.py --- a/antispam/tests/test_utils.py Sun Feb 09 14:31:35 2025 -0600 +++ b/antispam/tests/test_utils.py Mon Feb 10 19:34:14 2025 -0600 @@ -9,18 +9,19 @@ from django.contrib.contenttypes.models import ContentType from django.core.cache import cache +from mock import call, patch, Mock + from antispam import SPAM_PHRASE_KEY from antispam.models import SpamPhrase -from antispam.utils import contains_spam, deactivate_spammer - +from antispam.utils import contains_spam, deactivate_spammer, spam_check from comments.models import Comment from polls.models import Poll from elsewhere.models import WebsiteProfile from shoutbox.models import Shout -from bio.models import STA_SPAMMER +from bio.models import STA_ACTIVE, STA_SPAMMER, STA_STRANGER, STA_SUSPENDED -class AntispamCase(TestCase): +class AntispamUtilsCase(TestCase): def test_no_phrases(self): """ @@ -39,13 +40,13 @@ SpamPhrase.objects.create(phrase="allday.ru") SpamPhrase.objects.create(phrase="stefa.pl") - self.assert_(contains_spam("grytner")) - self.assert_(contains_spam("11grytner")) - self.assert_(contains_spam("11grytner>")) - self.assert_(contains_spam("1djkl jsd stefa.pl")) - self.assert_(contains_spam("1djkl jsd ")) + self.assertTrue(contains_spam("1djkl jsd stefa.pl")) + self.assertTrue(contains_spam("1djkl jsd