本文整理汇总了Python中blackhole.smtp.Smtp类的典型用法代码示例。如果您正苦于以下问题:Python Smtp类的具体用法?Python Smtp怎么用?Python Smtp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Smtp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_delay_range_and_mode
def test_delay_range_and_mode(self):
smtp = Smtp([])
smtp.delay = "30"
smtp.mode = "accept"
smtp._flags = {"delay": ["10", "20"], "mode": "bounce"}
assert smtp.delay in (10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)
assert smtp.mode == "bounce"
示例2: test_delay_switch_range_overrides_config
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 is 30
示例3: test_headers_enabled
def test_headers_enabled(self):
cfile = create_config(("dynamic_switch=true",))
Config(cfile).load()
smtp = Smtp([])
assert smtp.mode == "accept"
smtp.process_header("x-blackhole-mode: bounce")
assert smtp.mode == "bounce"
示例4: test_delay_and_mode
def test_delay_and_mode(self):
smtp = Smtp([])
smtp.delay = "30"
smtp.mode = "accept"
smtp._flags = {"delay": "20", "mode": "bounce"}
assert smtp.delay == 20
assert smtp.mode == "bounce"
示例5: test_headers_default
def test_headers_default(self):
cfile = create_config(("",))
Config(cfile).load()
smtp = Smtp([])
assert smtp.mode == "accept"
smtp.process_header("x-blackhole-mode: bounce")
assert smtp.mode == "bounce"
示例6: test_mode_valid_overrides_config
def test_mode_valid_overrides_config(self):
cfile = create_config(("mode=bounce",))
Config(cfile).load()
smtp = Smtp([])
assert smtp.mode == "bounce"
smtp.mode = "accept"
assert smtp.mode == "accept"
示例7: test_delay_switch_overrides_config_single
def test_delay_switch_overrides_config_single(self):
cfile = create_config(("delay=30",))
Config(cfile).load()
smtp = Smtp([])
smtp.delay = "60"
assert smtp.delay is 60
assert smtp.config.delay is 30
示例8: test_delay_switch_range_max_higher_than_60
def test_delay_switch_range_max_higher_than_60(self):
cfile = create_config(("",))
Config(cfile).load()
smtp = Smtp([])
smtp.delay = "59, 70"
assert smtp.delay in [59, 60]
示例9: test_delay_switch_range_min_higher_than_max
def test_delay_switch_range_min_higher_than_max(self):
cfile = create_config(("",))
Config(cfile).load()
smtp = Smtp([])
smtp.delay = "20, 10"
assert smtp.delay is None
示例10: test_delay_switch_invalid_range_negatives
def test_delay_switch_invalid_range_negatives(self):
cfile = create_config(("",))
Config(cfile).load()
smtp = Smtp([])
smtp.delay = "-10, -1"
assert smtp.delay is None
示例11: test_delay_switch_invalid_max_range_value_no_config
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
示例12: test_invalid_mode_header2
def test_invalid_mode_header2(self):
smtp = Smtp([])
assert smtp.mode == "accept"
smtp.process_header("x-some-mode: bounce")
assert smtp.mode == "accept"
示例13: test_valid_range_delay
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]
示例14: test_mode_valid
def test_mode_valid(self):
cfile = create_config(("",))
Config(cfile).load()
smtp = Smtp([])
smtp.mode = "bounce"
assert smtp.mode == "bounce"
示例15: test_mode_invalid
def test_mode_invalid(self):
cfile = create_config(("",))
Config(cfile).load()
smtp = Smtp([])
smtp.mode = "kura"
assert smtp.mode == "accept"