How to use the blackhole.smtp.Smtp function in blackhole

To help you get started, we’ve selected a few blackhole examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay_switch_range_overrides_config(self):
        cfile = create_config(("delay=30",))
        Config(cfile).load()
        smtp = Smtp([])
        smtp.delay = "40, 45"
        assert smtp.delay in [x for x in range(40, 46)]
        assert smtp.config.delay == 30
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay_switch_more_than_2(self):
        cfile = create_config(("",))
        Config(cfile).load()
        smtp = Smtp([])
        smtp.delay = "1, 2, 3"
        assert smtp.delay is None
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay_switch_invalid_single_value_config_60(self):
        cfile = create_config(("delay=30",))
        Config(cfile).load()
        smtp = Smtp([])
        smtp.delay = "fifteen"
        assert smtp.delay == 30
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay_switch_invalid_single_negative_value(self):
        cfile = create_config(("",))
        Config(cfile).load()
        smtp = Smtp([])
        smtp.delay = "-10"
        assert smtp.delay is None
github kura / blackhole / tests / test_smtp.py View on Github external
def test_auth_mechanisms():
    smtp = Smtp([])
    assert smtp.get_auth_members() == ["CRAM-MD5", "LOGIN", "PLAIN"]
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_valid_range_delay(self):
        smtp = Smtp([])
        assert smtp.delay is None
        smtp.process_header("x-blackhole-delay: 5, 10")
        assert smtp.delay in [5, 6, 7, 8, 9, 10]
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay_switch_invalid_max_range_value_no_config(self):
        cfile = create_config(("",))
        Config(cfile).load()
        smtp = Smtp([])
        smtp.delay = "15, eighteen"
        assert smtp.delay is None
github kura / blackhole / tests / test_smtp.py View on Github external
def test_initiation():
    cfile = create_config(("",))
    with mock.patch("os.access", return_value=False), mock.patch(
        "socket.getfqdn", return_value="a.blackhole.io"
    ):
        conf = Config(cfile)
    conf.load()
    smtp = Smtp([])
    assert smtp.fqdn == "a.blackhole.io"
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay(self):
        smtp = Smtp([])
        smtp.delay = "30"
        smtp._flags = {"delay": 20}
        assert smtp.delay == 20
github kura / blackhole / tests / test_smtp_switches.py View on Github external
def test_delay_not_enabled_or_set(self):
        cfile = create_config(("",))
        Config(cfile).load()
        smtp = Smtp([])
        assert smtp.delay is None