Skip to content

Commit c1c42f8

Browse files
committed
refactor(tests): migrate to connector-based tool naming
Update all test files to use connector-based naming conventions (hibob_*, bamboohr_*, workday_*) instead of legacy unified API naming (hris_*, ats_*, crm_*). This ensures tests remain consistent with the updated examples and reflect the actual tool naming used by StackOne connectors. Affected tests: - test_feedback.py - test_meta_tools.py - test_tfidf_index.py - test_toolset.py
1 parent e45ef1c commit c1c42f8

File tree

4 files changed

+47
-47
lines changed

4 files changed

+47
-47
lines changed

tests/test_feedback.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ def test_live_feedback_submission() -> None:
252252
{
253253
"feedback": f"CI live test feedback {feedback_token}",
254254
"account_id": f"acc-ci-{feedback_token}",
255-
"tool_names": ["hris_list_employees"],
255+
"tool_names": ["hibob_list_employees"],
256256
}
257257
)
258258

tests/test_meta_tools.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def sample_tools():
1717
"""Create sample tools for testing"""
1818
tools = []
1919

20-
# Create HRIS tools
20+
# Create HiBob tools
2121
for action in ["create", "list", "update", "delete"]:
2222
for entity in ["employee", "department", "timeoff"]:
23-
tool_name = f"hris_{action}_{entity}"
23+
tool_name = f"hibob_{action}_{entity}"
2424
execute_config = ExecuteConfig(
2525
name=tool_name,
2626
method="POST" if action in ["create", "update"] else "GET",
27-
url=f"https://api.example.com/hris/{entity}",
27+
url=f"https://api.example.com/hibob/{entity}",
2828
headers={},
2929
)
3030

@@ -37,21 +37,21 @@ def sample_tools():
3737
)
3838

3939
tool = StackOneTool(
40-
description=f"{action.capitalize()} {entity} in HRIS system",
40+
description=f"{action.capitalize()} {entity} in HiBob system",
4141
parameters=parameters,
4242
_execute_config=execute_config,
4343
_api_key="test_key",
4444
)
4545
tools.append(tool)
4646

47-
# Create ATS tools
47+
# Create BambooHR tools
4848
for action in ["create", "list", "search"]:
4949
for entity in ["candidate", "job", "application"]:
50-
tool_name = f"ats_{action}_{entity}"
50+
tool_name = f"bamboohr_{action}_{entity}"
5151
execute_config = ExecuteConfig(
5252
name=tool_name,
5353
method="POST" if action == "create" else "GET",
54-
url=f"https://api.example.com/ats/{entity}",
54+
url=f"https://api.example.com/bamboohr/{entity}",
5555
headers={},
5656
)
5757

@@ -64,7 +64,7 @@ def sample_tools():
6464
)
6565

6666
tool = StackOneTool(
67-
description=f"{action.capitalize()} {entity} in ATS system",
67+
description=f"{action.capitalize()} {entity} in BambooHR system",
6868
parameters=parameters,
6969
_execute_config=execute_config,
7070
_api_key="test_key",
@@ -217,13 +217,13 @@ def test_execute_tool_call(self, tools_collection):
217217
with responses.RequestsMock() as rsps:
218218
rsps.add(
219219
responses.GET,
220-
"https://api.example.com/hris/employee",
220+
"https://api.example.com/hibob/employee",
221221
json={"success": True, "employees": []},
222222
status=200,
223223
)
224224

225225
# Call the meta execute tool
226-
result = execute_tool.call(toolName="hris_list_employee", params={"limit": 10})
226+
result = execute_tool.call(toolName="hibob_list_employee", params={"limit": 10})
227227

228228
assert result is not None
229229
assert "success" in result or "employees" in result
@@ -288,14 +288,14 @@ def test_hybrid_search_returns_results(self, sample_tools):
288288
"""Test that hybrid search returns meaningful results"""
289289
index = ToolIndex(sample_tools, hybrid_alpha=0.2)
290290
# Use more specific query to ensure we get employee tools
291-
results = index.search("employee hris", limit=10)
291+
results = index.search("employee hibob", limit=10)
292292

293293
assert len(results) > 0
294-
# Should find HRIS employee tools - check in broader result set
294+
# Should find HiBob employee tools - check in broader result set
295295
result_names = [r.name for r in results]
296-
# At least one result should contain "employee" or "hris"
297-
assert any("employee" in name or "hris" in name for name in result_names), (
298-
f"Expected 'employee' or 'hris' in results: {result_names}"
296+
# At least one result should contain "employee" or "hibob"
297+
assert any("employee" in name or "hibob" in name for name in result_names), (
298+
f"Expected 'employee' or 'hibob' in results: {result_names}"
299299
)
300300

301301
def test_hybrid_search_with_different_alphas(self, sample_tools):

tests/test_tfidf_index.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ def test_stopword_filtering(self):
4444

4545
def test_underscore_preservation(self):
4646
"""Test that underscores are preserved"""
47-
text = "hris_list_employees"
47+
text = "hibob_list_employees"
4848
tokens = tokenize(text)
49-
assert "hris_list_employees" in tokens
49+
assert "hibob_list_employees" in tokens
5050

5151
def test_empty_string(self):
5252
"""Test tokenization of empty string"""
@@ -279,17 +279,17 @@ def test_tool_name_matching(self):
279279
"""Test matching tool names"""
280280
index = TfidfIndex()
281281
docs = [
282-
TfidfDocument(id="hris_create_employee", text="create employee hris system"),
283-
TfidfDocument(id="hris_list_employees", text="list employees hris system"),
284-
TfidfDocument(id="ats_create_candidate", text="create candidate ats system"),
285-
TfidfDocument(id="crm_list_contacts", text="list contacts crm system"),
282+
TfidfDocument(id="hibob_create_employee", text="create employee hibob system"),
283+
TfidfDocument(id="hibob_list_employees", text="list employees hibob system"),
284+
TfidfDocument(id="bamboohr_create_candidate", text="create candidate bamboohr system"),
285+
TfidfDocument(id="workday_list_contacts", text="list contacts workday system"),
286286
]
287287
index.build(docs)
288288

289-
# Search for HRIS tools
290-
results = index.search("employee hris", k=5)
289+
# Search for HiBob tools
290+
results = index.search("employee hibob", k=5)
291291
top_ids = [r.id for r in results[:2]]
292-
assert "hris_create_employee" in top_ids or "hris_list_employees" in top_ids
292+
assert "hibob_create_employee" in top_ids or "hibob_list_employees" in top_ids
293293

294294
# Search for create operations
295295
results = index.search("create", k=5)

tests/test_toolset.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -18,58 +18,58 @@ def test_filter_by_provider():
1818
toolset = StackOneToolSet(api_key="test_key")
1919

2020
# Test matching providers
21-
assert toolset._filter_by_provider("hris_list_employees", ["hris", "ats"])
22-
assert toolset._filter_by_provider("ats_create_job", ["hris", "ats"])
21+
assert toolset._filter_by_provider("hibob_list_employees", ["hibob", "bamboohr"])
22+
assert toolset._filter_by_provider("bamboohr_create_job", ["hibob", "bamboohr"])
2323

2424
# Test non-matching providers
25-
assert not toolset._filter_by_provider("crm_list_contacts", ["hris", "ats"])
25+
assert not toolset._filter_by_provider("workday_list_contacts", ["hibob", "bamboohr"])
2626

2727
# Test case-insensitive matching
28-
assert toolset._filter_by_provider("HRIS_list_employees", ["hris"])
29-
assert toolset._filter_by_provider("hris_list_employees", ["HRIS"])
28+
assert toolset._filter_by_provider("HIBOB_list_employees", ["hibob"])
29+
assert toolset._filter_by_provider("hibob_list_employees", ["HIBOB"])
3030

3131

3232
def test_filter_by_action():
3333
"""Test action filtering with glob patterns"""
3434
toolset = StackOneToolSet(api_key="test_key")
3535

3636
# Test exact match
37-
assert toolset._filter_by_action("hris_list_employees", ["hris_list_employees"])
37+
assert toolset._filter_by_action("hibob_list_employees", ["hibob_list_employees"])
3838

3939
# Test glob pattern
40-
assert toolset._filter_by_action("hris_list_employees", ["*_list_employees"])
41-
assert toolset._filter_by_action("ats_list_employees", ["*_list_employees"])
42-
assert toolset._filter_by_action("hris_list_employees", ["hris_*"])
43-
assert toolset._filter_by_action("hris_create_employee", ["hris_*"])
40+
assert toolset._filter_by_action("hibob_list_employees", ["*_list_employees"])
41+
assert toolset._filter_by_action("bamboohr_list_employees", ["*_list_employees"])
42+
assert toolset._filter_by_action("hibob_list_employees", ["hibob_*"])
43+
assert toolset._filter_by_action("hibob_create_employee", ["hibob_*"])
4444

4545
# Test non-matching patterns
46-
assert not toolset._filter_by_action("crm_list_contacts", ["*_list_employees"])
47-
assert not toolset._filter_by_action("ats_create_job", ["hris_*"])
46+
assert not toolset._filter_by_action("workday_list_contacts", ["*_list_employees"])
47+
assert not toolset._filter_by_action("bamboohr_create_job", ["hibob_*"])
4848

4949

5050
def test_matches_filter_positive_patterns():
5151
"""Test _matches_filter with positive patterns"""
5252
toolset = StackOneToolSet(api_key="test_key")
5353

5454
# Single pattern
55-
assert toolset._matches_filter("hris_list_employees", "hris_*")
56-
assert toolset._matches_filter("ats_create_job", "ats_*")
57-
assert not toolset._matches_filter("crm_contacts", "hris_*")
55+
assert toolset._matches_filter("hibob_list_employees", "hibob_*")
56+
assert toolset._matches_filter("bamboohr_create_job", "bamboohr_*")
57+
assert not toolset._matches_filter("workday_contacts", "hibob_*")
5858

5959
# Multiple patterns (OR logic)
60-
assert toolset._matches_filter("hris_list_employees", ["hris_*", "ats_*"])
61-
assert toolset._matches_filter("ats_create_job", ["hris_*", "ats_*"])
62-
assert not toolset._matches_filter("crm_contacts", ["hris_*", "ats_*"])
60+
assert toolset._matches_filter("hibob_list_employees", ["hibob_*", "bamboohr_*"])
61+
assert toolset._matches_filter("bamboohr_create_job", ["hibob_*", "bamboohr_*"])
62+
assert not toolset._matches_filter("workday_contacts", ["hibob_*", "bamboohr_*"])
6363

6464

6565
def test_matches_filter_negative_patterns():
6666
"""Test _matches_filter with negative patterns (exclusion)"""
6767
toolset = StackOneToolSet(api_key="test_key")
6868

6969
# Negative pattern
70-
assert not toolset._matches_filter("hris_delete_employee", ["hris_*", "!hris_delete_*"])
71-
assert toolset._matches_filter("hris_list_employees", ["hris_*", "!hris_delete_*"])
70+
assert not toolset._matches_filter("hibob_delete_employee", ["hibob_*", "!hibob_delete_*"])
71+
assert toolset._matches_filter("hibob_list_employees", ["hibob_*", "!hibob_delete_*"])
7272

7373
# Only negative patterns (should match everything not excluded)
74-
assert not toolset._matches_filter("hris_delete_employee", "!hris_delete_*")
75-
assert toolset._matches_filter("hris_list_employees", "!hris_delete_*")
74+
assert not toolset._matches_filter("hibob_delete_employee", "!hibob_delete_*")
75+
assert toolset._matches_filter("hibob_list_employees", "!hibob_delete_*")

0 commit comments

Comments
 (0)