Skip to content

Commit 7588cbe

Browse files
committed
fix: tests messages
1 parent 5b62cc4 commit 7588cbe

3 files changed

Lines changed: 20 additions & 20 deletions

File tree

packages/uipath-openai-agents/tests/cli/test_init.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55

66
from click.testing import CliRunner
7-
from uipath._cli.cli_init import init
7+
from uipath._cli import cli
88

99

1010
class TestInit:
@@ -30,7 +30,7 @@ def test_init_basic_config_generation(
3030
with open("openai_agents.json", "w") as f:
3131
f.write(openai_agents_config)
3232

33-
result = runner.invoke(init)
33+
result = runner.invoke(cli, ["init"])
3434
assert result.exit_code == 0
3535
assert os.path.exists("entry-points.json")
3636

@@ -54,9 +54,9 @@ def test_init_basic_config_generation(
5454
assert isinstance(input_schema["properties"], dict)
5555
assert isinstance(input_schema["required"], list)
5656

57-
# OpenAI agents use default message input
58-
assert "message" in input_schema["properties"]
59-
assert "message" in input_schema["required"]
57+
# OpenAI agents use default messages input
58+
assert "messages" in input_schema["properties"]
59+
assert "messages" in input_schema["required"]
6060

6161
# Verify output schema (default since no output_type specified)
6262
assert "output" in entry
@@ -87,7 +87,7 @@ def test_init_translation_agent_config_generation(
8787
with open("openai_agents.json", "w") as f:
8888
f.write(openai_agents_config)
8989

90-
result = runner.invoke(init)
90+
result = runner.invoke(cli, ["init"])
9191
assert result.exit_code == 0
9292
assert os.path.exists("entry-points.json")
9393

@@ -112,8 +112,8 @@ def test_init_translation_agent_config_generation(
112112
input_schema = translation_entry["input"]
113113
assert input_schema["type"] == "object"
114114
assert "properties" in input_schema
115-
assert "message" in input_schema["properties"]
116-
assert "message" in input_schema["required"]
115+
assert "messages" in input_schema["properties"]
116+
assert "messages" in input_schema["required"]
117117

118118
# Verify output schema from agent's output_type
119119
assert "output" in translation_entry

packages/uipath-openai-agents/tests/test_agent_as_tools_schema.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ def test_agent_as_tools_input_schema():
3333

3434
# OpenAI Agents use messages as input (not custom types)
3535
input_props = schema["input"]["properties"]
36-
assert "message" in input_props
36+
assert "messages" in input_props
3737

38-
# Verify message field accepts string or array
39-
assert "anyOf" in input_props["message"]
40-
types = [t.get("type") for t in input_props["message"]["anyOf"]]
38+
# Verify messages field accepts string or array
39+
assert "anyOf" in input_props["messages"]
40+
types = [t.get("type") for t in input_props["messages"]["anyOf"]]
4141
assert "string" in types
4242
assert "array" in types
4343

4444
# Check required fields
4545
assert "required" in schema["input"]
46-
assert "message" in schema["input"]["required"]
46+
assert "messages" in schema["input"]["required"]
4747

4848

4949
def test_agent_as_tools_output_schema():
@@ -86,7 +86,7 @@ def test_agent_as_tools_schema_metadata():
8686
# Input uses default messages format (no custom title/description)
8787
assert "input" in schema
8888
assert "properties" in schema["input"]
89-
assert "message" in schema["input"]["properties"]
89+
assert "messages" in schema["input"]["properties"]
9090

9191
# Check output metadata from agent's output_type
9292
assert "title" in schema["output"]

packages/uipath-openai-agents/tests/test_schema_inference.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def test_schema_inference_from_agent_output_type():
3535
# Check input schema - should be default messages format
3636
assert "input" in schema
3737
assert "properties" in schema["input"]
38-
assert "message" in schema["input"]["properties"]
38+
assert "messages" in schema["input"]["properties"]
3939
assert "required" in schema["input"]
40-
assert "message" in schema["input"]["required"]
40+
assert "messages" in schema["input"]["required"]
4141

4242
# Check output schema - extracted from agent's output_type
4343
assert "output" in schema
@@ -60,9 +60,9 @@ def test_schema_fallback_without_types():
6060
"""Test that schemas fall back to defaults when no types are provided."""
6161
schema = get_entrypoints_schema(test_agent)
6262

63-
# Should use default message-based input schema
63+
# Should use default messages-based input schema
6464
assert "input" in schema
65-
assert "message" in schema["input"]["properties"]
65+
assert "messages" in schema["input"]["properties"]
6666

6767
# Should fall back to default result-based output
6868
assert "output" in schema
@@ -73,9 +73,9 @@ def test_schema_with_plain_agent():
7373
"""Test schema extraction with a plain agent."""
7474
schema = get_entrypoints_schema(test_agent)
7575

76-
# Should use default message input
76+
# Should use default messages input
7777
assert "input" in schema
78-
assert "message" in schema["input"]["properties"]
78+
assert "messages" in schema["input"]["properties"]
7979

8080
# Should use default result output
8181
assert "output" in schema

0 commit comments

Comments
 (0)