-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
"""Unit tests for the CLI commands module.""" | ||
|
||
from click.testing import CliRunner | ||
from readmeai.cli.commands import commands | ||
|
||
|
||
def test_commands(): | ||
"""Test that the CLI command runs.""" | ||
runner = CliRunner() | ||
result = runner.invoke( | ||
commands, ["--repository", "https://github.com/example/repo"] | ||
) | ||
assert result.exit_code == 0 | ||
|
||
|
||
def test_commands_with_options(): | ||
"""Test that the CLI command runs with options.""" | ||
runner = CliRunner() | ||
result = runner.invoke( | ||
commands, | ||
[ | ||
"--repository", | ||
"https://github.com/example/repo", | ||
"--api-key", | ||
"your-api-key", | ||
"--model", | ||
"gpt-4", | ||
"--temperature", | ||
"0.8", | ||
], | ||
) | ||
assert result.exit_code == 0 | ||
|
||
|
||
def test_commands_missing_repository(): | ||
"""Test that the CLI command fails when repository option is missing.""" | ||
runner = CliRunner() | ||
result = runner.invoke(commands, ["--badges", "flat"]) | ||
assert result.exit_code != 0 | ||
assert "Usage: commands" in result.output | ||
|
||
|
||
if __name__ == "__main__": | ||
test_commands() | ||
test_commands_with_options() | ||
test_commands_missing_repository() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Unit tests for the CLI options module.""" |