Skip to content
Snippets Groups Projects
Commit f3f6a68a authored by Carlos Natalino Da Silva's avatar Carlos Natalino Da Silva
Browse files

Replacing the custom mock by a standard one.

parent 96c22d7e
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!210Fixing issues with the WebUI and the optical cybersecurity module
...@@ -58,12 +58,12 @@ def test_detect_attack( ...@@ -58,12 +58,12 @@ def test_detect_attack(
message = dbscan.DetectionResponse() message = dbscan.DetectionResponse()
message.cluster_indices.extend([0, 1, -1, -1, -1]) message.cluster_indices.extend([0, 1, -1, -1, -1])
monitoring_mock = MockServicerImpl_Monitoring(queue_samples = queue.Queue()) # monitoring_mock = MockServicerImpl_Monitoring(queue_samples = queue.Queue())
# TODO: remove the monitoring mock
with patch( with patch(
"opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.attack_mitigator_client" "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.attack_mitigator_client"
) as mitigator, patch( ) as mitigator, patch(
"opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.monitoring_client", "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.monitoring_client.IncludeKpi",
monitoring_mock,
) as monitoring, patch( ) as monitoring, patch(
"opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.dbscanserving_client.Detect", "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.dbscanserving_client.Detect",
# TODO: return dumb object with "cluster_indices" attribute # TODO: return dumb object with "cluster_indices" attribute
...@@ -77,5 +77,5 @@ def test_detect_attack( ...@@ -77,5 +77,5 @@ def test_detect_attack(
request.kpi_id.kpi_id.uuid = "1" request.kpi_id.kpi_id.uuid = "1"
optical_attack_detector_client.DetectAttack(request) optical_attack_detector_client.DetectAttack(request)
dbscanserving.assert_called_once() dbscanserving.assert_called_once()
monitoring.IncludeKpi.assert_called_once() monitoring.assert_called_once()
mitigator.NotifyAttack.assert_called() mitigator.NotifyAttack.assert_called()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment