Fix tests

This commit is contained in:
Cyber MacGeddon 2025-09-04 00:31:48 +01:00
parent 1b59d2d4d7
commit 4ea1de7a1f
2 changed files with 10 additions and 10 deletions

View file

@ -218,19 +218,19 @@ class TestConfigurationPriorityEndToEnd:
assert 'auth_provider' not in call_args.kwargs # No auth with default config
class TestBackwardCompatibilityEndToEnd:
"""Test backward compatibility with old parameter names end-to-end."""
class TestNoBackwardCompatibilityEndToEnd:
"""Test that backward compatibility with old parameter names is removed."""
@pytest.mark.asyncio
@patch('trustgraph.direct.cassandra.Cluster')
async def test_old_graph_params_still_work_end_to_end(self, mock_cluster):
"""Test that old graph_* parameters still work end-to-end."""
async def test_old_graph_params_no_longer_work_end_to_end(self, mock_cluster):
"""Test that old graph_* parameters no longer work end-to-end."""
mock_cluster_instance = MagicMock()
mock_session = MagicMock()
mock_cluster_instance.connect.return_value = mock_session
mock_cluster.return_value = mock_cluster_instance
# Use old parameter names
# Use old parameter names (should be ignored)
processor = TriplesWriter(
taskgroup=MagicMock(),
graph_host='legacy-host',
@ -246,11 +246,11 @@ class TestBackwardCompatibilityEndToEnd:
await processor.store_triples(mock_message)
# Should work with legacy parameters
# Should use defaults since old parameters are not recognized
mock_cluster.assert_called_once()
call_args = mock_cluster.call_args
assert call_args.args[0] == ['legacy-host']
assert 'auth_provider' in call_args.kwargs # Should have auth since credentials provided
assert call_args.args[0] == ['cassandra'] # Default, not legacy-host
assert 'auth_provider' not in call_args.kwargs # No auth since no valid credentials
@patch('trustgraph.storage.knowledge.store.KnowledgeTableStore')
def test_old_cassandra_user_param_still_works_end_to_end(self, mock_table_store):

View file

@ -294,8 +294,8 @@ class TestObjectsCassandraIntegration:
async def test_authentication_handling(self, processor_with_mocks):
"""Test Cassandra authentication"""
processor, mock_cluster, mock_session = processor_with_mocks
processor.graph_username = "cassandra_user"
processor.graph_password = "cassandra_pass"
processor.cassandra_username = "cassandra_user"
processor.cassandra_password = "cassandra_pass"
with patch('trustgraph.storage.objects.cassandra.write.Cluster') as mock_cluster_class:
with patch('trustgraph.storage.objects.cassandra.write.PlainTextAuthProvider') as mock_auth: