Skip to content

Commit 7f95cd5

Browse files
Copilotakollegger
andcommitted
Fix get_neo4j_import_dir to support both dbms.directories.import and server.directories.import
Co-authored-by: akollegger <53756+akollegger@users.noreply.github.com>
1 parent 0a0aceb commit 7f95cd5

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/agentic_kg/tools/cypher_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def get_neo4j_import_dir():
206206
graphdb = get_graphdb() # grab the singleton instance
207207
results = graphdb.send_query("""
208208
Call dbms.listConfig() YIELD name, value
209-
WHERE name CONTAINS 'server.directories.import'
209+
WHERE name CONTAINS 'directories.import'
210210
RETURN value as import_dir
211211
""")
212212
if results["status"] == "success":

tests/unit/test_cypher_tools.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""Unit tests for cypher_tools module."""
2+
3+
import inspect
4+
import pytest
5+
6+
from agentic_kg.tools.cypher_tools import get_neo4j_import_dir
7+
8+
9+
def test_get_neo4j_import_dir_query_contains_correct_filter():
10+
"""Test that get_neo4j_import_dir function uses the correct filter for configuration names.
11+
12+
This test ensures the function searches for 'directories.import' which matches both:
13+
- server.directories.import (traditional configuration)
14+
- dbms.directories.import (Community Edition configuration)
15+
"""
16+
# Get the source code of the function
17+
source = inspect.getsource(get_neo4j_import_dir)
18+
19+
# Verify the query contains the correct filter
20+
assert "WHERE name CONTAINS 'directories.import'" in source, (
21+
"Function should filter for 'directories.import' to match both "
22+
"'server.directories.import' and 'dbms.directories.import'"
23+
)
24+
25+
# Verify it doesn't contain the old, more restrictive filter
26+
assert "WHERE name CONTAINS 'server.directories.import'" not in source, (
27+
"Function should not use the restrictive 'server.directories.import' filter"
28+
)
29+
30+
31+
def test_get_neo4j_import_dir_function_signature():
32+
"""Test that the function signature hasn't changed."""
33+
# Verify the function exists and has the expected signature
34+
assert callable(get_neo4j_import_dir)
35+
36+
# Check that it takes no parameters
37+
sig = inspect.signature(get_neo4j_import_dir)
38+
assert len(sig.parameters) == 0, "Function should take no parameters"

0 commit comments

Comments
 (0)