Ejemplo n.º 1
0
def test_path_info(monkeypatch, equal):
    """Test _path_info().

    Args:
        equal: Whether system data / data and system config / config are equal.
    """
    patches = {
        'config': lambda auto=False: (
            'AUTO CONFIG PATH' if auto and not equal
            else 'CONFIG PATH'),
        'data': lambda system=False: (
            'SYSTEM DATA PATH' if system and not equal
            else 'DATA PATH'),
        'cache': lambda: 'CACHE PATH',
        'runtime': lambda: 'RUNTIME PATH',
    }

    for name, val in patches.items():
        monkeypatch.setattr(version.standarddir, name, val)

    pathinfo = version._path_info()

    assert pathinfo['config'] == 'CONFIG PATH'
    assert pathinfo['data'] == 'DATA PATH'
    assert pathinfo['cache'] == 'CACHE PATH'
    assert pathinfo['runtime'] == 'RUNTIME PATH'

    if equal:
        assert 'auto config' not in pathinfo
        assert 'system data' not in pathinfo
    else:
        assert pathinfo['auto config'] == 'AUTO CONFIG PATH'
        assert pathinfo['system data'] == 'SYSTEM DATA PATH'
Ejemplo n.º 2
0
def test_path_info(monkeypatch, equal):
    """Test _path_info().

    Args:
        equal: Whether system data / data and system config / config are equal.
    """
    patches = {
        'config': lambda auto=False:
            'AUTO CONFIG PATH' if auto and not equal
            else 'CONFIG PATH',
        'data': lambda system=False:
            'SYSTEM DATA PATH' if system and not equal
            else 'DATA PATH',
        'cache': lambda: 'CACHE PATH',
        'runtime': lambda: 'RUNTIME PATH',
    }

    for name, val in patches.items():
        monkeypatch.setattr(version.standarddir, name, val)

    pathinfo = version._path_info()

    assert pathinfo['config'] == 'CONFIG PATH'
    assert pathinfo['data'] == 'DATA PATH'
    assert pathinfo['cache'] == 'CACHE PATH'
    assert pathinfo['runtime'] == 'RUNTIME PATH'

    if equal:
        assert 'auto config' not in pathinfo
        assert 'system data' not in pathinfo
    else:
        assert pathinfo['auto config'] == 'AUTO CONFIG PATH'
        assert pathinfo['system data'] == 'SYSTEM DATA PATH'
Ejemplo n.º 3
0
def test_path_info(monkeypatch):
    """Test _path_info()."""
    patches = {
        'config': lambda: 'CONFIG PATH',
        'data': lambda: 'DATA PATH',
        'system_data': lambda: 'SYSTEM DATA PATH',
        'cache': lambda: 'CACHE PATH',
        'download': lambda: 'DOWNLOAD PATH',
        'runtime': lambda: 'RUNTIME PATH',
    }

    for attr, val in patches.items():
        monkeypatch.setattr('qutebrowser.utils.standarddir.' + attr, val)

    pathinfo = version._path_info()

    assert pathinfo['config'] == 'CONFIG PATH'
    assert pathinfo['data'] == 'DATA PATH'
    assert pathinfo['system_data'] == 'SYSTEM DATA PATH'
    assert pathinfo['cache'] == 'CACHE PATH'
    assert pathinfo['download'] == 'DOWNLOAD PATH'
    assert pathinfo['runtime'] == 'RUNTIME PATH'
Ejemplo n.º 4
0
def test_path_info(monkeypatch):
    """Test _path_info()."""
    patches = {
        'config': lambda: 'CONFIG PATH',
        'data': lambda: 'DATA PATH',
        'system_data': lambda: 'SYSTEM DATA PATH',
        'cache': lambda: 'CACHE PATH',
        'download': lambda: 'DOWNLOAD PATH',
        'runtime': lambda: 'RUNTIME PATH',
    }

    for attr, val in patches.items():
        monkeypatch.setattr(version.standarddir, attr, val)

    pathinfo = version._path_info()

    assert pathinfo['config'] == 'CONFIG PATH'
    assert pathinfo['data'] == 'DATA PATH'
    assert pathinfo['system_data'] == 'SYSTEM DATA PATH'
    assert pathinfo['cache'] == 'CACHE PATH'
    assert pathinfo['download'] == 'DOWNLOAD PATH'
    assert pathinfo['runtime'] == 'RUNTIME PATH'