1212 Job ,
1313 PlatformInfoJob ,
1414 PutFileJob ,
15+ RebootJob ,
1516 WhoAmIJob ,
1617)
1718
@@ -169,7 +170,7 @@ def test_wait_partial_block(self):
169170 def test_last_block_fill (self ):
170171 """Should fill space in last block with empty data on final update"""
171172 initial_data = b"\xde \xad \xbe \xef "
172- checksum = hexlify (sha256 (initial_data ).digest ()).decode (' utf-8' )
173+ checksum = hexlify (sha256 (initial_data ).digest ()).decode (" utf-8" )
173174 job = FirmwareUpdateJob ("ota" , [checksum ])
174175
175176 # Send and complete the update
@@ -195,7 +196,7 @@ def test_last_block_fill(self):
195196 def test_output (self ):
196197 """Should return the total bytes written as output"""
197198 initial_data = b"\xde \xad \xbe \xef "
198- checksum = hexlify (sha256 (initial_data ).digest ()).decode (' utf-8' )
199+ checksum = hexlify (sha256 (initial_data ).digest ()).decode (" utf-8" )
199200 job = FirmwareUpdateJob ("ota" , [checksum ])
200201
201202 # Send and complete the update
@@ -205,3 +206,17 @@ def test_output(self):
205206 # Output should be the total bytes written
206207 output = job .output ().read ().decode ("utf-8" ).strip ()
207208 self .assertEqual (output , "4" )
209+
210+
211+ class TestRebootJob (TestCase ):
212+ def test_run_hard (self ):
213+ """Reboot job should signal and perform a hard reboot"""
214+ job = RebootJob ("reboot" , ["hard" ])
215+ output = job .output ().read ().decode ("utf-8" ).strip ()
216+ self .assertEqual (output , "Performing hard reboot" )
217+
218+ def test_run_soft (self ):
219+ """Reboot job should signal a soft reboot"""
220+ job = RebootJob ("reboot" , ["soft" ])
221+ output = job .output ().read ().decode ("utf-8" ).strip ()
222+ self .assertEqual (output , "Performing soft reboot" )
0 commit comments