def test_import_list_from_mailman_existing(self, update_from_mailman): MailingList.objects.create(name="*****@*****.**") mm_mlist = FakeMMList("*****@*****.**") self.mailman_client.get_list.side_effect = lambda lid: mm_mlist mailman.import_list_from_mailman("list.example.com") self.assertTrue(self.mailman_client.get_list.called) self.assertEqual(self.mailman_client.get_list.call_args_list[0][0], ("list.example.com", )) self.assertEqual(update_from_mailman.call_count, 1)
def on_mailinglist_modified(sender, **kwargs): import_list_from_mailman(kwargs["list_id"])