Ejemplo n.º 1
0
def test_get_params_no_user(monkeypatch):
    monkeypatch.setattr(
        'builtins.input',
        lambda description: USER_INPUT_GENERIC,
    )
    p = GetParams(
        defaults=DEFAULTS,
        params=PARAMS,
    )
    del p.params['user']
    assert p.get_params(retries=1) is None
Ejemplo n.º 2
0
def test_get_params_popen_exception(monkeypatch):
    monkeypatch.setattr(
        'builtins.input',
        lambda description: USER_INPUT_GENERIC,
    )
    monkeypatch.setattr(
        'os.popen',
        lambda description: (_ for _ in ()).throw(Exception),
    )
    p = GetParams(
        defaults=DEFAULTS,
        params=PARAMS,
    )
    del p.params['user']
    assert p.get_params(retries=1) is None