From a045f9fe0072405e01c5fb203bf83edbda8560bd Mon Sep 17 00:00:00 2001
From: Carlos Natalino <carlos.natalino@chalmers.se>
Date: Tue, 11 Jul 2023 07:44:45 +0000
Subject: [PATCH] Improving tests.

---
 .../tests/test_unitary.py                     |  1 -
 .../tests/test_unitary.py                     | 35 ++++++++++---------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/opticalattackdetector/tests/test_unitary.py b/src/opticalattackdetector/tests/test_unitary.py
index d2fe74903..6c7579238 100644
--- a/src/opticalattackdetector/tests/test_unitary.py
+++ b/src/opticalattackdetector/tests/test_unitary.py
@@ -31,7 +31,6 @@ from opticalattackdetector.service.OpticalAttackDetectorService import \
 # from .example_objects import CONTEXT_ID, CONTEXT_ID_2, SERVICE_DEV1_DEV2
 
 LOGGER = logging.getLogger(__name__)
-LOGGER.setLevel(logging.DEBUG)
 
 
 @pytest.fixture(scope="session")
diff --git a/src/opticalattackmanager/tests/test_unitary.py b/src/opticalattackmanager/tests/test_unitary.py
index 0baecf925..0f50b3333 100644
--- a/src/opticalattackmanager/tests/test_unitary.py
+++ b/src/opticalattackmanager/tests/test_unitary.py
@@ -13,26 +13,27 @@
 # limitations under the License.
 
 import logging
-import os
-from unittest.mock import patch
+import uuid
 
-import pytest
+from opticalattackmanager.utils.monitor import delegate_services
 
-from common.Constants import (DEFAULT_GRPC_GRACE_PERIOD,
-                              DEFAULT_GRPC_MAX_WORKERS,
-                              DEFAULT_SERVICE_GRPC_PORTS, ServiceNameEnum)
-from common.proto import dbscanserving_pb2 as dbscan
-from common.proto.optical_attack_detector_pb2 import DetectionRequest
-from opticalattackdetector.client.OpticalAttackDetectorClient import \
-    OpticalAttackDetectorClient
-from opticalattackdetector.service.OpticalAttackDetectorService import \
-    OpticalAttackDetectorService
-
-# from .example_objects import CONTEXT_ID, CONTEXT_ID_2, SERVICE_DEV1_DEV2
 
 LOGGER = logging.getLogger(__name__)
-LOGGER.setLevel(logging.DEBUG)
 
 
-def test_detect_attack():
-    LOGGER.info("placeholder")
+def test_delegate_services():
+    service_list = [
+        {
+            "context": uuid.uuid4(),
+            "service": uuid.uuid4(),
+            "kpi": 10,
+        }
+        for _ in range(10)]
+    delegate_services(
+        service_list=service_list,
+        start_index=0,
+        end_index=9,
+        host="127.0.0.1",
+        port="10006",
+        monitoring_interval=10,
+    )
-- 
GitLab