Skip to content

Commit 4b79964

Browse files
committed
fix linter
1 parent 00fe92a commit 4b79964

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

simulation-system/libs/csle-common/tests/test_snort_ids_controller.py

+19-26
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,12 @@ def test_stop_snort_ides(self, mock_stop_snort_ids) -> None:
7373
)
7474

7575
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController.start_snort_manager")
76-
@patch(
77-
"csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_idses_monitor_threads_statuses_by_ip_and_port"
78-
)
76+
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController."
77+
"get_snort_idses_monitor_threads_statuses_by_ip_and_port")
7978
@patch("csle_collector.snort_ids_manager.query_snort_ids_manager.start_snort_ids")
8079
@patch("grpc.insecure_channel")
81-
def test_start_snort_ids(
82-
self, mock_insecure_channel, mock_start_snort_ids, mock_get_statuses, mock_start_manager
83-
) -> None:
80+
def test_start_snort_ids(self, mock_insecure_channel, mock_start_snort_ids, mock_get_statuses, mock_start_manager) \
81+
-> None:
8482
"""
8583
Test utility function for starting the Snort IDS on a specific IP
8684
@@ -111,13 +109,12 @@ def test_start_snort_ids(
111109
mock_start_snort_ids.assert_called()
112110

113111
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController.start_snort_manager")
114-
@patch(
115-
"csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_idses_monitor_threads_statuses_by_ip_and_port"
116-
)
112+
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController."
113+
"get_snort_idses_monitor_threads_statuses_by_ip_and_port")
117114
@patch("csle_collector.snort_ids_manager.query_snort_ids_manager.stop_snort_ids")
118115
@patch("grpc.insecure_channel")
119116
def test_stop_snort_ids(
120-
self, mock_insecure_channel, mock_stop_snort_ids, mock_get_statuses, mock_start_manager
117+
self, mock_insecure_channel, mock_stop_snort_ids, mock_get_statuses, mock_start_manager
121118
) -> None:
122119
"""
123120
Test utility function for stopping the Snort IDS on a specific IP
@@ -245,14 +242,12 @@ def test_start_snort_idses_monitor_threads(self, mock_start_monitor_thread) -> N
245242
self.logger.info.assert_called_once_with("Starting Snort IDS monitor thread on IP: 10.0.0.1")
246243

247244
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController.start_snort_manager")
248-
@patch(
249-
"csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_idses_monitor_threads_statuses_by_ip_and_port"
250-
)
245+
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController."
246+
"get_snort_idses_monitor_threads_statuses_by_ip_and_port")
251247
@patch("csle_collector.snort_ids_manager.query_snort_ids_manager.start_snort_ids_monitor")
252248
@patch("grpc.insecure_channel")
253-
def test_start_snort_idses_monitor_thread(
254-
self, mock_insecure_channel, mock_start_monitor, mock_get_statuses, mock_start_manager
255-
):
249+
def test_start_snort_idses_monitor_thread(self, mock_insecure_channel, mock_start_monitor, mock_get_statuses,
250+
mock_start_manager) -> None:
256251
"""
257252
Test a method that sends a request to the SnortIDSManager on a specific container that runs
258253
an IDS to start the IDS manager and the monitor thread
@@ -335,7 +330,8 @@ def test_stop_snort_idses_monitor_thread(self, mock_insecure_channel, mock_stop_
335330

336331
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController.start_snort_managers")
337332
@patch(
338-
"csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_idses_monitor_threads_statuses_by_ip_and_port"
333+
"csle_common.controllers.snort_ids_controller.SnortIDSController."
334+
"get_snort_idses_monitor_threads_statuses_by_ip_and_port"
339335
)
340336
def test_get_snort_idses_monitor_threads_statuses(self, mock_get_statuses, mock_start_managers) -> None:
341337
"""
@@ -365,9 +361,8 @@ def test_get_snort_idses_monitor_threads_statuses(self, mock_get_statuses, mock_
365361

366362
@patch("grpc.insecure_channel")
367363
@patch("csle_collector.snort_ids_manager.query_snort_ids_manager.get_snort_ids_monitor_status")
368-
def test_get_snort_idses_monitor_threads_statuses_by_ip_and_port(
369-
self, mock_get_status, mock_insecure_channel
370-
) -> None:
364+
def test_get_snort_idses_monitor_threads_statuses_by_ip_and_port(self, mock_get_status, mock_insecure_channel) \
365+
-> None:
371366
"""
372367
Test a method that sends a request to the SnortIDSManager with a specific port and ip
373368
to get the status of the IDS monitor thread
@@ -407,14 +402,13 @@ def test_get_snort_idses_managers_ports(self) -> None:
407402

408403
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_ids_managers_ips")
409404
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_idses_managers_ports")
410-
@patch(
411-
"csle_common.controllers.snort_ids_controller.SnortIDSController.get_snort_idses_monitor_threads_statuses_by_ip_and_port"
412-
)
405+
@patch("csle_common.controllers.snort_ids_controller.SnortIDSController."
406+
"get_snort_idses_monitor_threads_statuses_by_ip_and_port")
413407
@patch("csle_common.util.emulation_util.EmulationUtil.physical_ip_match")
414408
@patch("csle_collector.snort_ids_manager.snort_ids_manager_util.SnortIdsManagerUtil.snort_ids_monitor_dto_empty")
415409
def test_get_snort_managers_info(
416-
self, mock_snort_ids_monitor_dto_empty, mock_physical_ip_match, mock_get_statuses, mock_get_ports, mock_get_ips
417-
) -> None:
410+
self, mock_snort_ids_monitor_dto_empty, mock_physical_ip_match, mock_get_statuses, mock_get_ports,
411+
mock_get_ips) -> None:
418412
"""
419413
Test the method that extracts the information of the Snort managers for a given emulation
420414
@@ -445,7 +439,6 @@ def test_get_snort_managers_info(
445439
logger=self.logger,
446440
physical_server_ip=physical_server_ip,
447441
)
448-
449442
mock_get_ips.assert_called_once_with(emulation_env_config=emulation_env_config)
450443
mock_get_ports.assert_called_once_with(emulation_env_config=emulation_env_config)
451444
mock_get_statuses.assert_any_call(port=50051, ip="10.0.0.1")

0 commit comments

Comments
 (0)