Skip to content

Commit

Permalink
Merge branch 'master' into glennga/auditor_provider_fixes_1
Browse files Browse the repository at this point in the history
  • Loading branch information
glennga authored Jan 27, 2025
2 parents f56f8b6 + 414a6c9 commit 9c02cd2
Showing 1 changed file with 27 additions and 15 deletions.
42 changes: 27 additions & 15 deletions libs/agentc_cli/tests/test_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,14 @@ def test_publish_different_versions(tmp_path, isolated_server_factory):
assert row == 2


@pytest.mark.regression
def test_ls_local(tmp_path):
@pytest.mark.smoke
def test_ls_local_empty_notindexed(tmp_path):
runner = click.testing.CliRunner()
with runner.isolated_filesystem(temp_dir=tmp_path) as td:
############################################################################################################
# when the repo is empty
output = runner.invoke(click_main, ["ls", "-local"]).stdout
assert "Searching" not in output
############################################################################################################

# when there are tools and prompts, but are not indexed
initialize_repo(
directory=pathlib.Path(td),
Expand All @@ -426,7 +425,12 @@ def test_ls_local(tmp_path):
)
output = runner.invoke(click_main, ["ls", "-local"]).stdout
assert "Searching" not in output
############################################################################################################


@pytest.mark.smoke
def test_ls_local_only_tools(tmp_path):
runner = click.testing.CliRunner()
with runner.isolated_filesystem(temp_dir=tmp_path) as td:
# when only tools are indexed
initialize_repo(
directory=pathlib.Path(td),
Expand All @@ -435,23 +439,32 @@ def test_ls_local(tmp_path):
click_command=click_main,
)
output = runner.invoke(click_main, ["ls", "tool", "-local"]).stdout
assert "TOOL" in output and "1" in output
assert "TOOL" in output and len(re.findall(r"\b1\.\s.+", output)) == 1
output = runner.invoke(click_main, ["ls", "prompt", "-local"]).stdout
assert "PROMPT" in output and "1" not in output
############################################################################################################
assert "PROMPT" in output and len(re.findall(r"\b1\.\s.+", output)) == 0


@pytest.mark.smoke
def test_ls_local_only_prompts(tmp_path):
runner = click.testing.CliRunner()
with runner.isolated_filesystem(temp_dir=tmp_path) as td:
# when only prompts are indexed
runner.invoke(click_main, ["clean", "local", "--kind", "tool", "-y"])
initialize_repo(
directory=pathlib.Path(td),
repo_kind=ExampleRepoKind.INDEXED_CLEAN_PROMPTS_TRAVEL,
click_runner=runner,
click_command=click_main,
)
output = runner.invoke(click_main, ["ls", "prompt", "-local"]).stdout
assert "PROMPT" in output and "1" in output
assert "PROMPT" in output and len(re.findall(r"\b1\.\s.+", output)) == 1
output = runner.invoke(click_main, ["ls", "tool", "-local"]).stdout
assert "TOOL" in output and "1" not in output
############################################################################################################
assert "TOOL" in output and len(re.findall(r"\b1\.\s.+", output)) == 0


@pytest.mark.smoke
def test_ls_local_both_tools_prompts(tmp_path):
runner = click.testing.CliRunner()
with runner.isolated_filesystem(temp_dir=tmp_path) as td:
# when there are both tools and prompts
initialize_repo(
directory=pathlib.Path(td),
Expand All @@ -460,9 +473,8 @@ def test_ls_local(tmp_path):
click_command=click_main,
)
output = runner.invoke(click_main, ["ls", "prompt", "-local"]).stdout
assert "PROMPT" in output and "1" in output
assert "PROMPT" in output and len(re.findall(r"\b1\.\s.+", output)) == 1
output = runner.invoke(click_main, ["ls", "tool", "-local"]).stdout
assert "TOOL" in output and "1" in output
assert "TOOL" in output and len(re.findall(r"\b1\.\s.+", output)) == 1
output = runner.invoke(click_main, ["ls", "-local"]).stdout
assert "PROMPT" in output and "TOOL" in output and len(re.findall(r"\b1\.\s.+", output)) == 2
############################################################################################################

0 comments on commit 9c02cd2

Please sign in to comment.