diff --git a/tests/unit/test_storage/test_objects_cassandra_storage.py b/tests/unit/test_storage/test_objects_cassandra_storage.py index 2b250c35..072c2a86 100644 --- a/tests/unit/test_storage/test_objects_cassandra_storage.py +++ b/tests/unit/test_storage/test_objects_cassandra_storage.py @@ -251,6 +251,8 @@ class TestObjectsCassandraStorageLogic: processor.convert_value = Processor.convert_value.__get__(processor, Processor) processor.session = MagicMock() processor.on_object = Processor.on_object.__get__(processor, Processor) + processor.known_keyspaces = {"test_user"} # Pre-populate to skip validation query + processor.known_tables = {"test_user": set()} # Pre-populate # Create test object test_obj = ExtractedObject( @@ -415,6 +417,8 @@ class TestObjectsCassandraStorageBatchLogic: processor.convert_value = Processor.convert_value.__get__(processor, Processor) processor.session = MagicMock() processor.on_object = Processor.on_object.__get__(processor, Processor) + processor.known_keyspaces = {"test_user"} # Pre-populate to skip validation query + processor.known_tables = {"test_user": set()} # Pre-populate # Create empty batch object empty_batch_obj = ExtractedObject( @@ -461,6 +465,8 @@ class TestObjectsCassandraStorageBatchLogic: processor.convert_value = Processor.convert_value.__get__(processor, Processor) processor.session = MagicMock() processor.on_object = Processor.on_object.__get__(processor, Processor) + processor.known_keyspaces = {"test_user"} # Pre-populate to skip validation query + processor.known_tables = {"test_user": set()} # Pre-populate # Create single-item batch object (backward compatibility case) single_batch_obj = ExtractedObject( diff --git a/tests/unit/test_storage/test_triples_falkordb_storage.py b/tests/unit/test_storage/test_triples_falkordb_storage.py index f9dfbc5d..09a0f6e5 100644 --- a/tests/unit/test_storage/test_triples_falkordb_storage.py +++ b/tests/unit/test_storage/test_triples_falkordb_storage.py @@ -194,7 +194,13 @@ class TestFalkorDBStorageProcessor: mock_result.run_time_ms = 10 processor.io.query.return_value = mock_result - await processor.store_triples(message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(message) # Verify queries were called in the correct order expected_calls = [ @@ -225,7 +231,13 @@ class TestFalkorDBStorageProcessor: mock_result.run_time_ms = 10 processor.io.query.return_value = mock_result - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(mock_message) # Verify queries were called in the correct order expected_calls = [ @@ -273,7 +285,13 @@ class TestFalkorDBStorageProcessor: mock_result.run_time_ms = 10 processor.io.query.return_value = mock_result - await processor.store_triples(message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(message) # Verify total number of queries (3 per triple) assert processor.io.query.call_count == 6 @@ -299,7 +317,13 @@ class TestFalkorDBStorageProcessor: message.metadata.collection = 'test_collection' message.triples = [] - await processor.store_triples(message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(message) # Verify no queries were made processor.io.query.assert_not_called() @@ -329,7 +353,13 @@ class TestFalkorDBStorageProcessor: mock_result.run_time_ms = 10 processor.io.query.return_value = mock_result - await processor.store_triples(message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(message) # Verify total number of queries (3 per triple) assert processor.io.query.call_count == 6 diff --git a/tests/unit/test_storage/test_triples_memgraph_storage.py b/tests/unit/test_storage/test_triples_memgraph_storage.py index 4cced655..c8c000ce 100644 --- a/tests/unit/test_storage/test_triples_memgraph_storage.py +++ b/tests/unit/test_storage/test_triples_memgraph_storage.py @@ -308,7 +308,13 @@ class TestMemgraphStorageProcessor: # Reset the mock to clear initialization calls processor.io.execute_query.reset_mock() - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(mock_message) # Verify execute_query was called for create_node, create_literal, and relate_literal # (since mock_message has a literal object) @@ -352,7 +358,13 @@ class TestMemgraphStorageProcessor: ) message.triples = [triple1, triple2] - await processor.store_triples(message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(message) # Verify execute_query was called: # Triple1: create_node(s) + create_literal(o) + relate_literal = 3 calls @@ -381,7 +393,13 @@ class TestMemgraphStorageProcessor: message.metadata.collection = 'test_collection' message.triples = [] - await processor.store_triples(message) + # Mock collection_exists to bypass validation in unit tests + + + with patch.object(processor, \'collection_exists\', return_value=True): + + + await processor.store_triples(message) # Verify no session calls were made (no triples to process) processor.io.session.assert_not_called() diff --git a/tests/unit/test_storage/test_triples_neo4j_storage.py b/tests/unit/test_storage/test_triples_neo4j_storage.py index e600d227..2e307102 100644 --- a/tests/unit/test_storage/test_triples_neo4j_storage.py +++ b/tests/unit/test_storage/test_triples_neo4j_storage.py @@ -268,7 +268,9 @@ class TestNeo4jStorageProcessor: mock_message.metadata.user = "test_user" mock_message.metadata.collection = "test_collection" - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + with patch.object(processor, 'collection_exists', return_value=True): + await processor.store_triples(mock_message) # Verify create_node was called for subject and object # Verify relate_node was called @@ -336,7 +338,9 @@ class TestNeo4jStorageProcessor: mock_message.metadata.user = "test_user" mock_message.metadata.collection = "test_collection" - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + with patch.object(processor, 'collection_exists', return_value=True): + await processor.store_triples(mock_message) # Verify create_node was called for subject # Verify create_literal was called for object @@ -411,7 +415,9 @@ class TestNeo4jStorageProcessor: mock_message.metadata.user = "test_user" mock_message.metadata.collection = "test_collection" - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + with patch.object(processor, 'collection_exists', return_value=True): + await processor.store_triples(mock_message) # Should have processed both triples # Triple1: 2 nodes + 1 relationship = 3 calls @@ -437,7 +443,9 @@ class TestNeo4jStorageProcessor: mock_message.metadata.user = "test_user" mock_message.metadata.collection = "test_collection" - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + with patch.object(processor, 'collection_exists', return_value=True): + await processor.store_triples(mock_message) # Should not have made any execute_query calls beyond index creation # Only index creation calls should have been made during initialization @@ -552,7 +560,9 @@ class TestNeo4jStorageProcessor: mock_message.metadata.user = "test_user" mock_message.metadata.collection = "test_collection" - await processor.store_triples(mock_message) + # Mock collection_exists to bypass validation in unit tests + with patch.object(processor, 'collection_exists', return_value=True): + await processor.store_triples(mock_message) # Verify the triple was processed with special characters preserved mock_driver.execute_query.assert_any_call(