Example #1
0
    def test_no_whitelist(self):
        from karl.utilities.mailer import WhiteListMailDelivery
        sender = DummyMailDelivery()
        delivery = WhiteListMailDelivery(sender)

        delivery.send("a", ["b", "c"], "message")
        self.assertEqual(1, len(sender.calls))
        self.assertEqual(["b", "c"], sender.calls[0]["toaddrs"])
Example #2
0
    def test_no_recipients(self):
        from karl.utilities.mailer import WhiteListMailDelivery
        sender = DummyMailDelivery()
        self._set_whitelist(["d"])

        delivery = WhiteListMailDelivery(sender)
        delivery.send("a", ["b", "c"], "message")
        self.assertEqual(0, len(sender.calls))
Example #3
0
    def test_case_insensitive(self):
        from karl.utilities.mailer import WhiteListMailDelivery
        sender = DummyMailDelivery()
        self._set_whitelist(["*****@*****.**", '*****@*****.**'])

        delivery = WhiteListMailDelivery(sender)
        delivery.send("a", ["*****@*****.**", "*****@*****.**"], "message")
        self.assertEqual(1, len(sender.calls))
        self.assertEqual(
            ["*****@*****.**", "*****@*****.**"], sender.calls[0]["toaddrs"])