pbi-cli/tests/test_errors.py
MinaSaad1 144222aa31 feat: support Microsoft Store PBI Desktop and update setup docs
- Add Store version path (~\Microsoft\Power BI Desktop Store App\)
  alongside MSI path for port auto-discovery
- Fix UTF-16 LE encoding when reading msmdsrv.port.txt
- Update all 5 skills to reflect new install flow (pipx + pbi connect)
- Update error messages, docstrings, and READMEs to mention pbi connect
  as the primary entry point instead of pbi setup
- Add tests for Store path discovery, encoding, and path candidates
2026-03-26 19:58:54 +02:00

36 lines
987 B
Python

"""Tests for pbi_cli.core.errors."""
from __future__ import annotations
import click
from pbi_cli.core.errors import (
BinaryNotFoundError,
ConnectionRequiredError,
McpToolError,
PbiCliError,
)
def test_pbi_cli_error_is_click_exception() -> None:
err = PbiCliError("test message")
assert isinstance(err, click.ClickException)
assert err.format_message() == "test message"
def test_binary_not_found_default_message() -> None:
err = BinaryNotFoundError()
assert "pbi connect" in err.format_message()
def test_connection_required_default_message() -> None:
err = ConnectionRequiredError()
assert "pbi connect" in err.format_message()
def test_mcp_tool_error_includes_tool_name() -> None:
err = McpToolError("measure_operations", "not found")
assert "measure_operations" in err.format_message()
assert "not found" in err.format_message()
assert err.tool_name == "measure_operations"
assert err.detail == "not found"