Exemplo n.º 1
0
 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")
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 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")
Exemplo n.º 4
0
 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")
Exemplo n.º 5
0
 def test_check_sensor_position_passes_when_position_is_valid(self):
     # Arrange
     sensor = json.loads('{"position": 1}')
     # Act & Assert
     check.check_sensor_position(sensor)
Exemplo n.º 6
0
 def test_check_sensor_position_passes_when_position_is_valid(self):
     # Arrange
     sensor = json.loads('{"position": 1}')
     # Act & Assert
     check.check_sensor_position(sensor)