@@ -56,12 +56,23 @@ def setup_class(cls):
5656 def test_populate_reboot_status_flag (self ):
5757 with mock .patch ("time.time" , return_value = 1617811205.25 ):
5858 self .reboot_module .populate_reboot_status_flag ()
59- assert self .reboot_module .reboot_status_flag ["active" ] == False
60- assert self .reboot_module .reboot_status_flag ["when" ] == 0
61- assert self .reboot_module .reboot_status_flag ["reason" ] == ""
62- assert self .reboot_module .reboot_status_flag ["count" ] == 0
63- assert self .reboot_module .reboot_status_flag ["method" ] == ""
64- assert self .reboot_module .reboot_status_flag ["status" ] == RebootStatus .STATUS_UNKNOWN
59+ return_value , get_reboot_status_flag_data = self .reboot_module .get_reboot_status ()
60+ assert return_value == 0
61+ get_reboot_status_flag_data = json .loads (get_reboot_status_flag_data )
62+ assert get_reboot_status_flag_data ["active" ] == False
63+ assert get_reboot_status_flag_data ["when" ] == 0
64+ assert get_reboot_status_flag_data ["reason" ] == ""
65+ assert get_reboot_status_flag_data ["count" ] == 0
66+ assert get_reboot_status_flag_data ["method" ] == ""
67+ assert get_reboot_status_flag_data ["status" ] == RebootStatus .STATUS_UNKNOWN .value
68+
69+ def test_populate_reboot_status_flag_with_status (self ):
70+ with mock .patch ("time.time" , return_value = 1617811205.25 ):
71+ self .reboot_module .populate_reboot_status_flag (status = RebootStatus .STATUS_SUCCESS )
72+ return_value , get_reboot_status_flag_data = self .reboot_module .get_reboot_status ()
73+ assert return_value == 0
74+ get_reboot_status_flag_data = json .loads (get_reboot_status_flag_data )
75+ assert get_reboot_status_flag_data ["status" ] == RebootStatus .STATUS_SUCCESS .value
6576
6677 def test_validate_reboot_request_success_cold_boot_enum_method (self ):
6778 reboot_request = {"method" : REBOOT_METHOD_COLD_BOOT_ENUM , "reason" : "test reboot request reason" }
@@ -344,26 +355,26 @@ def test_issue_reboot_fail_issue_reboot_thread(self):
344355
345356 def test_get_reboot_status_active (self ):
346357 MSG = "testing reboot response"
347- self .reboot_module .populate_reboot_status_flag (True , TIME , MSG , REBOOT_METHOD_COLD_BOOT_ENUM , RebootStatus .STATUS_SUCCESS . name )
358+ self .reboot_module .populate_reboot_status_flag (True , TIME , MSG , REBOOT_METHOD_COLD_BOOT_ENUM , RebootStatus .STATUS_SUCCESS )
348359 result = self .reboot_module .get_reboot_status ()
349360 assert result [0 ] == 0
350361 response_data = json .loads (result [1 ])
351362 assert response_data ["active" ] == True
352363 assert response_data ["when" ] == TIME
353364 assert response_data ["reason" ] == MSG
354365 assert response_data ["method" ] == REBOOT_METHOD_COLD_BOOT_ENUM
355- assert response_data ["status" ] == RebootStatus .STATUS_SUCCESS .name
366+ assert response_data ["status" ] == RebootStatus .STATUS_SUCCESS .value
356367
357368 def test_get_reboot_status_inactive (self ):
358- self .reboot_module .populate_reboot_status_flag (False , 0 , "" , REBOOT_METHOD_COLD_BOOT_ENUM , RebootStatus .STATUS_SUCCESS . name )
369+ self .reboot_module .populate_reboot_status_flag (False , 0 , "" , REBOOT_METHOD_COLD_BOOT_ENUM , RebootStatus .STATUS_SUCCESS )
359370 result = self .reboot_module .get_reboot_status ()
360371 assert result [0 ] == 0
361372 response_data = json .loads (result [1 ])
362373 assert response_data ["active" ] == False
363374 assert response_data ["when" ] == 0
364375 assert response_data ["reason" ] == ""
365376 assert response_data ["method" ] == REBOOT_METHOD_COLD_BOOT_ENUM
366- assert response_data ["status" ] == RebootStatus .STATUS_SUCCESS .name
377+ assert response_data ["status" ] == RebootStatus .STATUS_SUCCESS .value
367378
368379# assert result[1] == TEST_INACTIVE_RESPONSE_DATA
369380
0 commit comments