1818from ravendb .documents .operations .connection_string .put_connection_string_operation import (
1919 PutConnectionStringOperation ,
2020)
21+ from ravendb .documents .operations .connection_string .remove_connection_string_by_name_operation import \
22+ RemoveConnectionStringByNameOperation
2123from ravendb .documents .operations .connection_string .remove_connection_string_operation import (
2224 RemoveConnectionStringOperation ,
2325)
@@ -84,7 +86,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
8486
8587 # 3. Delete
8688 remove_result = self .store .maintenance .send (
87- RemoveConnectionStringOperation ("raven1" , ConnectionStringType . RAVEN )
89+ RemoveConnectionStringOperation (raven_connection_string )
8890 )
8991 self .assertGreater (remove_result .raft_command_index , 0 )
9092
@@ -103,7 +105,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
103105 self .assertEqual (1 , len (sql_get_result .sql_connection_strings ))
104106
105107 # 3. Delete
106- remove_result = self .store .maintenance .send (RemoveConnectionStringOperation ("sql1" , ConnectionStringType . SQL ))
108+ remove_result = self .store .maintenance .send (RemoveConnectionStringOperation (sql_connection_string ))
107109 self .assertGreater (remove_result .raft_command_index , 0 )
108110
109111 # 4. Get and Assert None
@@ -121,7 +123,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
121123 self .assertEqual (1 , len (olap_get_result .olap_connection_strings ))
122124
123125 # 3. Delete
124- remove_result = self .store .maintenance .send (RemoveConnectionStringOperation ("olap1" , ConnectionStringType . OLAP ))
126+ remove_result = self .store .maintenance .send (RemoveConnectionStringOperation (olap_connection_string ))
125127 self .assertGreater (remove_result .raft_command_index , 0 )
126128
127129 # 4. Get and Assert None
@@ -141,7 +143,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
141143
142144 # 3. Delete
143145 remove_result = self .store .maintenance .send (
144- RemoveConnectionStringOperation ("elastic1" , ConnectionStringType . ELASTIC_SEARCH )
146+ RemoveConnectionStringOperation (elastic_search_connection_string )
145147 )
146148 self .assertGreater (remove_result .raft_command_index , 0 )
147149
@@ -165,7 +167,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
165167
166168 # 3. Delete
167169 remove_result = self .store .maintenance .send (
168- RemoveConnectionStringOperation ("queue1" , ConnectionStringType . QUEUE )
170+ RemoveConnectionStringOperation (queue_connection_string )
169171 )
170172 self .assertGreater (remove_result .raft_command_index , 0 )
171173
@@ -187,7 +189,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
187189
188190 # 3. Delete
189191 remove_result = self .store .maintenance .send (
190- RemoveConnectionStringOperation ("snowflake1" , ConnectionStringType . SNOWFLAKE )
192+ RemoveConnectionStringOperation (snowflake_connection_string )
191193 )
192194 self .assertGreater (remove_result .raft_command_index , 0 )
193195
@@ -208,7 +210,7 @@ def test_full_lifecycle_for_all_connection_string_types(self):
208210 self .assertEqual (1 , len (ai_get_result .ai_connection_strings ))
209211
210212 # 3. Delete
211- remove_result = self .store .maintenance .send (RemoveConnectionStringOperation ("ai1" , ConnectionStringType . AI ))
213+ remove_result = self .store .maintenance .send (RemoveConnectionStringOperation (ai_connection_string ))
212214 self .assertGreater (remove_result .raft_command_index , 0 )
213215
214216 # 4. Get and Assert None
@@ -238,7 +240,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
238240
239241 # Delete
240242 remove_result = self .store .maintenance .send (
241- RemoveConnectionStringOperation ("raven_all_fields" , ConnectionStringType . RAVEN )
243+ RemoveConnectionStringOperation (raven_connection_string )
242244 )
243245 self .assertGreater (remove_result .raft_command_index , 0 )
244246
@@ -272,7 +274,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
272274
273275 # Delete
274276 remove_result = self .store .maintenance .send (
275- RemoveConnectionStringOperation ("sql_all_fields" , ConnectionStringType . SQL )
277+ RemoveConnectionStringOperation (sql_connection_string )
276278 )
277279 self .assertGreater (remove_result .raft_command_index , 0 )
278280
@@ -468,7 +470,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
468470
469471 # Delete
470472 remove_result = self .store .maintenance .send (
471- RemoveConnectionStringOperation ("olap_all_fields" , ConnectionStringType . OLAP )
473+ RemoveConnectionStringOperation (olap_connection_string )
472474 )
473475 self .assertGreater (remove_result .raft_command_index , 0 )
474476
@@ -519,7 +521,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
519521
520522 # Delete
521523 remove_result = self .store .maintenance .send (
522- RemoveConnectionStringOperation ("ai_openai_chat" , ConnectionStringType . AI )
524+ RemoveConnectionStringOperation (ai_openai_chat_connection_string )
523525 )
524526 self .assertGreater (remove_result .raft_command_index , 0 )
525527
@@ -570,7 +572,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
570572
571573 # Delete
572574 remove_result = self .store .maintenance .send (
573- RemoveConnectionStringOperation ("ai_openai_embeddings" , ConnectionStringType . AI )
575+ RemoveConnectionStringOperation (ai_openai_embeddings_connection_string )
574576 )
575577 self .assertGreater (remove_result .raft_command_index , 0 )
576578
@@ -619,7 +621,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
619621
620622 # Delete
621623 remove_result = self .store .maintenance .send (
622- RemoveConnectionStringOperation ("ai_azure_openai" , ConnectionStringType . AI )
624+ RemoveConnectionStringOperation (ai_azure_openai_connection_string )
623625 )
624626 self .assertGreater (remove_result .raft_command_index , 0 )
625627
@@ -662,7 +664,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
662664
663665 # Delete
664666 remove_result = self .store .maintenance .send (
665- RemoveConnectionStringOperation ("ai_ollama" , ConnectionStringType . AI )
667+ RemoveConnectionStringOperation (ai_ollama_connection_string )
666668 )
667669 self .assertGreater (remove_result .raft_command_index , 0 )
668670
@@ -695,7 +697,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
695697
696698 # Delete
697699 remove_result = self .store .maintenance .send (
698- RemoveConnectionStringOperation ("ai_embedded" , ConnectionStringType . AI )
700+ RemoveConnectionStringOperation (ai_embedded_connection_string )
699701 )
700702 self .assertGreater (remove_result .raft_command_index , 0 )
701703
@@ -733,7 +735,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
733735
734736 # Delete
735737 remove_result = self .store .maintenance .send (
736- RemoveConnectionStringOperation ("ai_google" , ConnectionStringType . AI )
738+ RemoveConnectionStringOperation (ai_google_connection_string )
737739 )
738740 self .assertGreater (remove_result .raft_command_index , 0 )
739741
@@ -775,7 +777,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
775777
776778 # Delete
777779 remove_result = self .store .maintenance .send (
778- RemoveConnectionStringOperation ("ai_huggingface" , ConnectionStringType . AI )
780+ RemoveConnectionStringOperation (ai_huggingface_connection_string )
779781 )
780782 self .assertGreater (remove_result .raft_command_index , 0 )
781783
@@ -815,7 +817,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
815817
816818 # Delete
817819 remove_result = self .store .maintenance .send (
818- RemoveConnectionStringOperation ("ai_mistral" , ConnectionStringType . AI )
820+ RemoveConnectionStringOperation (ai_mistral_connection_string )
819821 )
820822 self .assertGreater (remove_result .raft_command_index , 0 )
821823
@@ -882,7 +884,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
882884
883885 # Delete
884886 remove_result = self .store .maintenance .send (
885- RemoveConnectionStringOperation ("elastic_all_fields" , ConnectionStringType . ELASTIC_SEARCH )
887+ RemoveConnectionStringOperation (elastic_search_connection_string )
886888 )
887889 self .assertGreater (remove_result .raft_command_index , 0 )
888890
@@ -1017,7 +1019,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
10171019
10181020 # Delete
10191021 remove_result = self .store .maintenance .send (
1020- RemoveConnectionStringOperation ("queue_all_fields" , ConnectionStringType . QUEUE )
1022+ RemoveConnectionStringOperation (queue_connection_string )
10211023 )
10221024 self .assertGreater (remove_result .raft_command_index , 0 )
10231025
@@ -1049,7 +1051,7 @@ def test_all_possible_fields_for_each_connection_string_type(self):
10491051
10501052 # Delete
10511053 remove_result = self .store .maintenance .send (
1052- RemoveConnectionStringOperation ("snowflake_all_fields" , ConnectionStringType . SNOWFLAKE )
1054+ RemoveConnectionStringOperation (snowflake_connection_string )
10531055 )
10541056 self .assertGreater (remove_result .raft_command_index , 0 )
10551057
@@ -1058,3 +1060,23 @@ def test_all_possible_fields_for_each_connection_string_type(self):
10581060 GetConnectionStringsOperation ("snowflake_all_fields" , ConnectionStringType .SNOWFLAKE )
10591061 )
10601062 self .assertIsNone (after_delete .snowflake_connection_strings )
1063+
1064+ def test_remove_connection_string_by_name_operation (self ):
1065+ raven_connection_string = RavenConnectionString ("raven1" , self .store .database , self .store .urls )
1066+
1067+ put_result = self .store .maintenance .send (PutConnectionStringOperation (raven_connection_string ))
1068+ self .assertGreater (put_result .raft_command_index , 0 )
1069+
1070+ raven_get_result = self .store .maintenance .send (
1071+ GetConnectionStringsOperation ("raven1" , ConnectionStringType .RAVEN )
1072+ )
1073+ self .assertIn ("raven1" , raven_get_result .raven_connection_strings )
1074+ self .assertEqual (1 , len (raven_get_result .raven_connection_strings ))
1075+
1076+ remove_result = self .store .maintenance .send (
1077+ RemoveConnectionStringByNameOperation ("raven1" , ConnectionStringType .RAVEN )
1078+ )
1079+ self .assertGreater (remove_result .raft_command_index , 0 )
1080+
1081+ after_delete = self .store .maintenance .send (GetConnectionStringsOperation ("raven1" , ConnectionStringType .RAVEN ))
1082+ self .assertIsNone (after_delete .raven_connection_strings )
0 commit comments