def test_check_sensor_position_raises_exception_when_position_is_zero(self): # Arrange sensor = json.loads('{"position": 0}') # Act with self.assertRaises(Exception) as context: check.check_sensor_position(sensor) # Assert self.assertEqual(context.exception.message, "'position' in sensor configuration must be greater than zero")
def test_check_sensor_position_raises_exception_when_position_is_not_integer(self): # Arrange sensor = json.loads('{"position": "bogus"}') # Act with self.assertRaises(Exception) as context: check.check_sensor_position(sensor) # Assert self.assertEqual(context.exception.message, "'position' in sensor configuration must be " "integer, but got unicode")
def test_check_sensor_position_raises_exception_when_position_is_zero( self): # Arrange sensor = json.loads('{"position": 0}') # Act with self.assertRaises(Exception) as context: check.check_sensor_position(sensor) # Assert self.assertEqual( context.exception.message, "'position' in sensor configuration must be greater than zero")
def test_check_sensor_position_raises_exception_when_position_is_not_integer( self): # Arrange sensor = json.loads('{"position": "bogus"}') # Act with self.assertRaises(Exception) as context: check.check_sensor_position(sensor) # Assert self.assertEqual( context.exception.message, "'position' in sensor configuration must be " "integer, but got unicode")
def test_check_sensor_position_passes_when_position_is_valid(self): # Arrange sensor = json.loads('{"position": 1}') # Act & Assert check.check_sensor_position(sensor)