예제 #1
0
def test_no_access(mock_os_access):
    conf = Config()
    conf.config_file = '/fake/file.conf'
    with pytest.raises(ConfigException):
        conf.load()
    assert mock_os_access.called is True
    assert mock_os_access.call_count is 1
예제 #2
0
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'
예제 #3
0
def test_no_access():
    conf = Config()
    conf.config_file = '/fake/file.conf'
    with mock.patch('os.access', return_value=False) as mock_os_access, \
            pytest.raises(ConfigException):
        conf.load()
    assert mock_os_access.called is True
    assert mock_os_access.call_count is 1
예제 #4
0
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"
예제 #5
0
def test_no_access():
    conf = Config()
    conf.config_file = "/fake/file.conf"
    with mock.patch("os.access",
                    return_value=False) as mock_os_access, pytest.raises(
                        ConfigException):
        conf.load()
    assert mock_os_access.called is True
    assert mock_os_access.call_count is 1
예제 #6
0
파일: test_smtp.py 프로젝트: kura/blackhole
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"