11"""Test the GetFileJob."""
22
33import asyncio
4+ import logging
45import os
56from binascii import hexlify
67from hashlib import sha256
@@ -129,7 +130,6 @@ def test_run(self):
129130
130131
131132class TestFirmwareUpdateJob (TestCase ):
132-
133133 def test_update_sha (self ):
134134 """Should update the SHA256 hash with each update"""
135135 job = FirmwareUpdateJob ("ota" , ["firmware.bin" ])
@@ -209,6 +209,15 @@ def test_output(self):
209209
210210
211211class TestRebootJob (TestCase ):
212+ def setUp (self ):
213+ # Turn off logging during tests
214+ self .logger = logging .getLogger ()
215+ self .old_level = self .logger .level
216+ self .logger .setLevel (logging .CRITICAL )
217+
218+ def tearDown (self ):
219+ self .logger .setLevel (self .old_level )
220+
212221 def test_run_hard (self ):
213222 """Reboot job should signal and perform a hard reboot"""
214223 job = RebootJob ("reboot" , ["hard" ])
@@ -219,6 +228,5 @@ def test_run_hard(self):
219228 def test_run_soft (self ):
220229 """Reboot job should signal a soft reboot"""
221230 job = RebootJob ("reboot" , ["soft" ])
222- # TODO: turn off or mock logger here to ignore the output
223231 output = job .output ().read ().decode ("utf-8" ).strip ()
224232 self .assertEqual (output , "Performing soft reboot" )
0 commit comments