From 085b5b82847afbe23c5ad9d2fa54e67a9271106b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ante=20Pu=C5=A1i=C4=87?= <ante.pusic@memgraph.io>
Date: Mon, 15 Jan 2024 20:30:08 +0100
Subject: [PATCH] Add new text fixture

---
 tests/e2e/text_search/common.py           | 13 +++++++++
 tests/e2e/text_search/test_text_search.py | 34 +++++++++++------------
 2 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/tests/e2e/text_search/common.py b/tests/e2e/text_search/common.py
index 870c80d83..bdcb9202e 100644
--- a/tests/e2e/text_search/common.py
+++ b/tests/e2e/text_search/common.py
@@ -43,3 +43,16 @@ def memgraph(**kwargs) -> Memgraph:
 
     memgraph.drop_database()
     memgraph.drop_indexes()
+
+
+@pytest.fixture
+def memgraph_with_text_indexed_data(**kwargs) -> Memgraph:
+    memgraph = Memgraph()
+
+    memgraph.execute_and_fetch("CREATE TEXT INDEX complianceDocuments ON :Document;")
+
+    yield memgraph
+
+    memgraph.execute_and_fetch("DROP TEXT INDEX complianceDocuments;")
+    memgraph.drop_database()
+    memgraph.drop_indexes()
diff --git a/tests/e2e/text_search/test_text_search.py b/tests/e2e/text_search/test_text_search.py
index a4550dd33..2209f8fe5 100644
--- a/tests/e2e/text_search/test_text_search.py
+++ b/tests/e2e/text_search/test_text_search.py
@@ -12,7 +12,7 @@
 import sys
 
 import pytest
-from common import memgraph
+from common import memgraph, memgraph_with_text_indexed_data
 
 
 def test_create_index(memgraph):
@@ -26,36 +26,36 @@ def test_drop_index(memgraph):
     assert True
 
 
-def test_text_search_given_property():
-    assert True
+def test_text_search_given_property(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_text_search_all_properties():
-    assert True
+def test_text_search_all_properties(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_create_indexed_node():
-    assert True
+def test_create_indexed_node(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_delete_indexed_node():
-    assert True
+def test_delete_indexed_node(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_add_indexed_label():
-    assert True
+def test_add_indexed_label(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_remove_indexed_label():
-    assert True
+def test_remove_indexed_label(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_add_property_to_indexed_node():
-    assert True
+def test_add_property_to_indexed_node(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
-def test_remove_property_from_indexed_node():
-    assert True
+def test_remove_property_from_indexed_node(memgraph_with_text_indexed_data):
+    memgraph_with_text_indexed_data.execute_and_fetch("CALL text_search.search('complianceDocuments', 'b') YIELD *;")
 
 
 if __name__ == "__main__":