Ejemplo n.º 1
0
def test_ensure_binary__uses_existing_file_if_valid(
    mocker, binary_url, binary_path, check_file, download_file
):
    mocker.patch('os.path.isfile').return_value = True
    check_file.return_value = True
    cli.ensure_binary()
    assert download_file.call_count == 0
Ejemplo n.º 2
0
def test_ensure_binary__downloads_missing_file(
    mocker, binary_url, binary_path, download_file
):
    mocker.patch('os.path.isfile').return_value = False
    cli.ensure_binary()
    download_file.assert_called_once_with(
        binary_url.return_value,
        binary_path.return_value
    )
Ejemplo n.º 3
0
def test_ensure_binary__downloads_new_file_if_existing_invalid(
    mocker, binary_url, binary_path, check_file, download_file
):
    mocker.patch('os.path.isfile').return_value = True
    check_file.return_value = False
    cli.ensure_binary()
    download_file.assert_called_once_with(
        binary_url.return_value,
        binary_path.return_value
    )
Ejemplo n.º 4
0
def test_ensure_binary__returns_existing_filename(
    mocker, binary_url, binary_path, check_file, download_file
):
    mocker.patch('os.path.isfile').return_value = True
    check_file.return_value = True
    result = cli.ensure_binary()
    assert result == binary_path.return_value
Ejemplo n.º 5
0
def test_ensure_binary__returns_downloaded_filename(
    mocker, binary_url, binary_path, download_file
):
    mocker.patch('os.path.isfile').return_value = False
    result = cli.ensure_binary()
    assert result == binary_path.return_value