1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
import tempfile
from muttdown.config import Config
def test_smtp_password_literal():
c = Config()
c.merge_config({'smtp_password': 'foo'})
assert c.smtp_password == 'foo'
def test_smtp_password_command():
c = Config()
c.merge_config({'smtp_password_command': 'sh -c "echo foo"'})
assert c.smtp_password == 'foo'
def test_css():
c = Config()
c.merge_config({'css_file': None})
assert c.css == ''
with tempfile.NamedTemporaryFile(delete=True) as css_file:
css_file.write(b'html { background-color: black; }\n')
css_file.flush()
c.merge_config({'css_file': css_file.name})
assert c.css == 'html { background-color: black; }\n'
|