コード例 #1
0
ファイル: test_check.py プロジェクト: si618/pi-time
 def test_check_sensor_location_raises_exception_when_location_is_invalid(self):
     # Arrange
     sensor = json.loads('{"location": "bogus"}')
     # Act
     with self.assertRaises(Exception) as context:
         check.check_sensor_location(sensor)
     # Assert
     self.assertEqual(context.exception.message,
                      "'location' in sensor configuration must be "
                      "('START', 'FINISH', 'START_FINISH', 'SECTOR'), "
                      "but got bogus")
コード例 #2
0
ファイル: test_check.py プロジェクト: movermeyer/pi-time
 def test_check_sensor_location_raises_exception_when_location_is_invalid(
         self):
     # Arrange
     sensor = json.loads('{"location": "bogus"}')
     # Act
     with self.assertRaises(Exception) as context:
         check.check_sensor_location(sensor)
     # Assert
     self.assertEqual(
         context.exception.message,
         "'location' in sensor configuration must be "
         "('START', 'FINISH', 'START_FINISH', 'SECTOR'), "
         "but got bogus")
コード例 #3
0
ファイル: test_check.py プロジェクト: si618/pi-time
 def test_check_sensor_location_passes_when_location_is_valid(self):
     # Arrange
     sensor = json.loads('{"location": "%s"}' %
                         settings.SENSOR_LOCATION_START)
     # Act & Assert
     check.check_sensor_location(sensor)
コード例 #4
0
ファイル: test_check.py プロジェクト: movermeyer/pi-time
 def test_check_sensor_location_passes_when_location_is_valid(self):
     # Arrange
     sensor = json.loads('{"location": "%s"}' %
                         settings.SENSOR_LOCATION_START)
     # Act & Assert
     check.check_sensor_location(sensor)