<commit_before>import mock

from core.tests import SwithcesTestCase
from .helpers.factories import EventFactory, EventUpdateFactory


class EventSwitchesTestCase(SwithcesTestCase):

    @mock.patch('events.models.jabber')
    def test_supporters_autonotify(self, mock_jabber):
        event = EventFactory()

        self.set_switch('supporters-autonotify', False)
        EventUpdateFactory(event=event)
        self.assertFalse(mock_jabber.notify_supporters.called)

        self.set_switch('supporters-autonotify')
        EventUpdateFactory(event=event)
        self.assertEqual(mock_jabber.notify_supporters.call_count, 1)<commit_msg>ticket:68 Merge branch 'production'<commit_after>import mock

from core.tests import SwithcesTestCase
from .helpers.factories import EventFactory, EventUpdateFactory


class EventSwitchesTestCase(SwithcesTestCase):

    @mock.patch('events.models.jabber')
    def test_supporters_autonotify(self, mock_jabber):
        event1, event2 = EventFactory(), EventFactory()

        self.set_switch('supporters-autonotify', False)
        EventUpdateFactory(event=event1)
        self.assertFalse(mock_jabber.notify_supporters.called)

        self.set_switch('supporters-autonotify')
        EventUpdateFactory(event=event2)
        self.assertEqual(mock_jabber.notify_supporters.call_count, 1)
{'fraction_non_alphanumeric': 0.08816880180859081, 'fraction_numerical': 0.006028636021100226, 'mean_word_length': 4.724137931034483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4930943', 'n_tokens_mistral': 406, 'n_tokens_neox': 386, 'n_words': 58}