File: test_config.py

package info (click to toggle)
muttdown 0.3.3-1
  • links: PTS, VCS
  • area: contrib
  • in suites: buster
  • size: 148 kB
  • sloc: python: 375; makefile: 7; sh: 3
file content (27 lines) | stat: -rw-r--r-- 704 bytes parent folder | download | duplicates (3)
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'