Commit f3f6a68a authored by Carlos Natalino's avatar Carlos Natalino
Browse files

Replacing the custom mock by a standard one.

parent 96c22d7e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -58,12 +58,12 @@ def test_detect_attack(
    message = dbscan.DetectionResponse()
    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(
        "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.attack_mitigator_client"
    ) as mitigator, patch(
        "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.monitoring_client",
        monitoring_mock,
        "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.monitoring_client.IncludeKpi",
    ) as monitoring, patch(
        "opticalattackdetector.service.OpticalAttackDetectorServiceServicerImpl.dbscanserving_client.Detect",
        # TODO: return dumb object with "cluster_indices" attribute
@@ -77,5 +77,5 @@ def test_detect_attack(
            request.kpi_id.kpi_id.uuid = "1"
            optical_attack_detector_client.DetectAttack(request)
            dbscanserving.assert_called_once()
            monitoring.IncludeKpi.assert_called_once()
            monitoring.assert_called_once()
        mitigator.NotifyAttack.assert_called()