import pytest
from click.testing import CliRunner
from olaf import cli


@pytest.fixture
def runner():
    return CliRunner()


def test_cli(runner):
    result = runner.invoke(cli.main, ['freeze', '-p', 'tests/dummy_reqs'], input='1\n')
    assert result.exit_code == 0
    assert not result.exception
    assert 'tests/dummy_reqs.txt specifies version 0.0.9 of olaf' in result.output.strip()
    assert 'olaf==0.1.3' in result.output.strip()
