From 138174dd5a9e506eb1550b40a4041b38614a5e00 Mon Sep 17 00:00:00 2001
From: "Jan.Gerhards" <jan@gerhards.net>
Date: Fri, 3 Jul 2020 15:25:46 +0200
Subject: [PATCH] continue implementing tests for pus service 20

---
 tc/obsw_tc_service20.py       | 44 +++++++++++++++++++++++++++++++++--
 test/obsw_pus_service_test.py |  2 +-
 2 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/tc/obsw_tc_service20.py b/tc/obsw_tc_service20.py
index e86b0cb..40ffc25 100644
--- a/tc/obsw_tc_service20.py
+++ b/tc/obsw_tc_service20.py
@@ -18,26 +18,66 @@ def pack_service20_test_into(tc_queue: Deque, called_externally: bool = False) -
     object_id = g.DUMMY_DEVICE_ID
 
     #test invalid subservice
+    #use subservice 130 for invalid subservice check, as this is in use for dump reply
+    #(and therefore will never be a valid subservice)
+    tc_queue.appendleft(("print", "Testing Service 20: Invalid subservice"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=130, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test invalid objectid //TODO: do we have an objectid known to be empty (even in future)?
+    tc_queue.appendleft(("print", "Testing Service 20: Invalid object ID"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=128, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test invalid parameterID for load
+    tc_queue.appendleft(("print", "Testing Service 20: Invalid parameter ID for load"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=128, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test invalid parameterID for dump
+    tc_queue.appendleft(("print", "Testing Service 20: Invalid parameter ID for dump"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=129, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test checking Load for uint32_t
+    tc_queue.appendleft(("print", "Testing Service 20: Load uint32_t"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=128, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test checking Dump for uint32_t
+    tc_queue.appendleft(("print", "Testing Service 20: Dump uint32_t"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=129, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test checking Load for int32_t
+    tc_queue.appendleft(("print", "Testing Service 20: Load int32_t"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=128, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test checking Dump for int32_t
+    tc_queue.appendleft(("print", "Testing Service 20: Dump int32_t"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=129, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test checking Load for float
+    tc_queue.appendleft(("print", "Testing Service 20: Load float"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=128, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     #test checking Dump for float
-
-
+    tc_queue.appendleft(("print", "Testing Service 20: Dump float"))
+    mode_data = pack_mode_data(object_id, 2, 0)
+    command = PusTelecommand(service=20, subservice=129, ssc=810, app_data=mode_data)
+    tc_queue.appendleft(command.pack_command_tuple())
 
     if called_externally is False:
         tc_queue.appendleft(("export", "log/tmtc_log_service8.txt"))
diff --git a/test/obsw_pus_service_test.py b/test/obsw_pus_service_test.py
index e546a92..487efe0 100644
--- a/test/obsw_pus_service_test.py
+++ b/test/obsw_pus_service_test.py
@@ -196,7 +196,7 @@ class TestService20(TestService): #TODO: implement correctly
         cls.data_reply_count = 0
         pack_service20_test_into(cls.test_queue)
 
-    def test_Service8(self):
+    def test_Service20(self):
 
         assertion_dict = self.perform_testing_and_generate_assertion_dict()
         # 3 x Mode changes
-- 
GitLab