@@ -59,12 +59,9 @@ def test_load_with_service_discovery(
5959 }
6060 mock_loader .return_value = mock_loader_inst
6161
62- mock_event1 = MagicMock ()
63- mock_event1 .json_event = json .dumps (
64- {"port" : 80 , "response" : {"conditions_results" : {"http" : {}}}}
65- )
66-
67- mock_find_events .return_value = [mock_event1 ]
62+ mock_find_events .return_value = [
63+ json .dumps ({"port" : 80 , "response" : {"conditions_results" : {"http" : {}}}})
64+ ]
6865
6966 module = Module ("test_module" , options , ** module_args )
7067 module .load ()
@@ -97,11 +94,9 @@ def test_sort_loops(mock_loader, mock_find_events, options, module_args):
9794 }
9895 mock_loader .return_value = mock_loader_inst
9996
100- mock_event = MagicMock ()
101- mock_event .json_event = json .dumps (
102- {"port" : 80 , "response" : {"conditions_results" : {"http" : True }}}
103- )
104- mock_find_events .return_value = [mock_event ]
97+ mock_find_events .return_value = [
98+ json .dumps ({"port" : 80 , "response" : {"conditions_results" : {"http" : True }}})
99+ ]
105100
106101 module = Module ("test_module" , options , ** module_args )
107102 module .libraries = ["http" ]
@@ -122,11 +117,9 @@ def test_start_unsupported_library(mock_loader, mock_find_events, options, modul
122117 }
123118 mock_loader .return_value = mock_loader_inst
124119
125- mock_event = MagicMock ()
126- mock_event .json_event = json .dumps (
127- {"port" : 1234 , "response" : {"conditions_results" : {"unsupported_lib" : True }}}
128- )
129- mock_find_events .return_value = [mock_event ]
120+ mock_find_events .return_value = [
121+ json .dumps ({"port" : 1234 , "response" : {"conditions_results" : {"unsupported_lib" : True }}})
122+ ]
130123
131124 module = Module ("test_module" , options , ** module_args )
132125 module .libraries = ["http" ]
@@ -182,11 +175,9 @@ def test_sort_loops_behavior(mock_loader_cls, mock_find_events, mock_parse, opti
182175 # This one is painful
183176 mock_loader_cls .side_effect = template_loader_side_effect
184177
185- mock_event = MagicMock ()
186- mock_event .json_event = json .dumps (
187- {"port" : 80 , "response" : {"conditions_results" : {"http" : True }}}
188- )
189- mock_find_events .return_value = [mock_event ]
178+ mock_find_events .return_value = [
179+ json .dumps ({"port" : 80 , "response" : {"conditions_results" : {"http" : True }}})
180+ ]
190181
191182 module = Module ("test_module" , options , ** module_args )
192183 module .libraries = ["http" ]
@@ -310,12 +301,8 @@ def loader_side_effect_specific(name, inputs):
310301
311302 mock_loader_cls .side_effect = loader_side_effect_specific
312303 mock_find_events .return_value = [
313- MagicMock (
314- json_event = json .dumps ({"port" : 80 , "response" : {"conditions_results" : {"http" : {}}}})
315- ),
316- MagicMock (
317- json_event = json .dumps ({"port" : 443 , "response" : {"conditions_results" : {"http" : {}}}})
318- ),
304+ json .dumps ({"port" : 80 , "response" : {"conditions_results" : {"http" : {}}}}),
305+ json .dumps ({"port" : 443 , "response" : {"conditions_results" : {"http" : {}}}}),
319306 ]
320307
321308 module = Module ("test_module" , options , ** module_args )
0 commit comments