def test_check_hardware_raises_exception_when_hardware_is_invalid(self): # Arrange sensor = json.loads('{"hardware": "bogus"}') # Act with self.assertRaises(Exception) as context: check.check_hardware(sensor, 'sensor') # Assert self.assertEqual(context.exception.message, "'hardware' in sensor configuration must be " "('RPI_REV1', 'RPI_REV2', 'RPI_B+', 'TEST'), " "but got bogus")
def test_check_hardware_raises_exception_when_hardware_is_invalid(self): # Arrange sensor = json.loads('{"hardware": "bogus"}') # Act with self.assertRaises(Exception) as context: check.check_hardware(sensor, 'sensor') # Assert self.assertEqual( context.exception.message, "'hardware' in sensor configuration must be " "('RPI_REV1', 'RPI_REV2', 'RPI_B+', 'TEST'), " "but got bogus")
def test_check_hardware_passes_when_hardware_is_valid(self): # Arrange sensor = json.loads('{"hardware": "%s"}' % settings.HARDWARE_RPI_BPLUS) # Act & Assert check.check_hardware(sensor, 'sensor')