Пример #1
0
def test_handle_options_help(capsys):
    # we can get help if we want
    with pytest.raises(SystemExit) as exc_info:
        handle_options(['-h'])
    out, err = capsys.readouterr()
    assert exc_info.value.code == 0
    assert "show this help message and exit" in out
Пример #2
0
def test_handle_options_no_phrase(capsys):
    # we tell, that a passphrase is required
    with pytest.raises(SystemExit) as exc_info:
        handle_options([])
    out, err = capsys.readouterr()
    assert exc_info.value.code == 2
    assert "is required" in err
Пример #3
0
def test_handle_options_help_long(capsys):
    # we support the long help option
    with pytest.raises(SystemExit) as exc_info:
        handle_options(['--help'])
    out, err = capsys.readouterr()
    assert exc_info.value.code == 0
    assert "show this help message and exit" in out
Пример #4
0
def test_handle_options_passphrse():
    # we can tell a passphrase to check
    args = handle_options(['some-passphrase'])
    args.passphrase == 'some-passphrase'
Пример #5
0
def test_handle_options_version():
    # we support --version
    args = handle_options(['--version'])
    assert args.version is True
    assert args.passphrase is None