|
1 | 1 | import pytest |
2 | 2 | from typer.testing import CliRunner |
3 | 3 | from pplx_cli.cli import app |
4 | | -from pplx_cli.config import PerplexityModel, save_api_key, Config, load_api_key |
| 4 | +from pplx_cli.config import PerplexityModel, save_api_key, Config, load_api_key, get_version |
5 | 5 | import os |
6 | 6 | from pathlib import Path |
7 | 7 |
|
@@ -74,3 +74,19 @@ def test_model_selection(runner, mock_config, requests_mock): |
74 | 74 | result = runner.invoke(app, ["ask", "--model", "small", "test"]) |
75 | 75 | assert result.exit_code == 0 |
76 | 76 | assert "Test response" in result.stdout |
| 77 | + |
| 78 | +def test_help_command(runner): |
| 79 | + """Test that --help flag works correctly.""" |
| 80 | + result = runner.invoke(app, ["--help"]) |
| 81 | + assert result.exit_code == 0 |
| 82 | + assert "Perplexity CLI" in result.stdout |
| 83 | + assert "Commands" in result.stdout or "commands" in result.stdout.lower() |
| 84 | + assert "ask" in result.stdout |
| 85 | + |
| 86 | +def test_version_flag(runner): |
| 87 | + """Test that --version flag works correctly.""" |
| 88 | + result = runner.invoke(app, ["--version"]) |
| 89 | + assert result.exit_code == 0 |
| 90 | + assert "Perplexity CLI version" in result.stdout |
| 91 | + version_str = get_version() |
| 92 | + assert version_str in result.stdout |
0 commit comments