示例#1
0
def test_vhost_parse():
    """Tests vhost parse method."""
    vhost = Vhost(DEFAULT_ARGS)
    vhost.data = VHOST_DATA
    assert vhost.parse() == {'htdocs'     : {'path' : '/the/root/dir'},
                             'access_log' : {'path' : '/the/access/log'},
                             'error_log'  : {'path' : '/the/error/log'},
                             'log'        : {'path' : '/the/access'}}
示例#2
0
def test_vhost_init(*args):
    """Tests vhost init method."""
    vhost = Vhost(DEFAULT_ARGS)
    vhost.data = VHOST_DATA
    assert vhost.domain == 'example.com'
    assert vhost.htdocs == '/the/root/dir'
    assert vhost.access_log == '/the/access/log'
    assert vhost.error_log == '/the/error/log'
示例#3
0
def test_vhost_parse_with_prompts():
    """Tests vhost parse method with prompts."""
    vhost = Vhost(DEFAULT_ARGS)
    vhost.data = ''
    with patch(_INPUT, return_value='/a/sample/dir'):
        assert vhost.parse() == {'htdocs'     : {'path' : '/a/sample/dir'},
                                 'access_log' : {'path' : '/a/sample/dir'},
                                 'error_log'  : {'path' : '/a/sample/dir'},
                                 'log'        : {'path' : '/a/sample'}}
    assert vhost.htdocs == '/a/sample/dir'
    assert vhost.access_log == '/a/sample/dir'
    assert vhost.error_log == '/a/sample/dir'