Пример #1
0
 def test_add_track_fails_when_unit_of_measurement_invalid(self):
     # Arrange & Act
     result = api_track.add_track('bogus track', 50, 100, 'FUBAR')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('add_track', result.call)
     self.assertEqual('Invalid unit of measurement', result.data)
Пример #2
0
 def test_add_track_fails_when_unit_of_measurement_invalid(self):
     # Arrange & Act
     result = api_track.add_track('bogus track', 50, 100, 'FUBAR')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('add_track', result.call)
     self.assertEqual('Invalid unit of measurement', result.data)
Пример #3
0
 def test_add_track_fails_when_timeout_invalid(self):
     # Arrange & Act
     result = api_track.add_track('bogus track', 50, 'FUBAR', settings.METRIC)
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('add_track', result.call)
     self.assertEqual('ValueError', result.data)
Пример #4
0
 def test_add_track_fails_when_timeout_invalid(self):
     # Arrange & Act
     result = api_track.add_track('bogus track', 50, 'FUBAR',
                                  settings.METRIC)
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('add_track', result.call)
     self.assertEqual('ValueError', result.data)
Пример #5
0
 def test_add_track_passes(self):
     # Arrange
     name = 'bogus track'
     # Act
     result = api_track.add_track(name, 50, 100, settings.METRIC)
     # Assert
     self.assertTrue(Track.objects.filter(name=name).exists())
     self.assertTrue(result.ok)
     self.assertEqual('add_track', result.call)
     track = Track.objects.get(name=name)
     self.assertEqual(track, result.data)
Пример #6
0
 def test_add_track_passes(self):
     # Arrange
     name = 'bogus track'
     # Act
     result = api_track.add_track(name, 50, 100, settings.METRIC)
     # Assert
     self.assertTrue(Track.objects.filter(name=name).exists())
     self.assertTrue(result.ok)
     self.assertEqual('add_track', result.call)
     track = Track.objects.get(name=name)
     self.assertEqual(track, result.data)
Пример #7
0
 def test_add_track_fails_when_track_found(self):
     # Arrange
     track = Track.objects.create(name='bogus track', distance=50,
         timeout=100, unit_of_measurement=settings.METRIC)
     # Act
     result = api_track.add_track(track.name, track.distance, track.timeout,
         track.unit_of_measurement)
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('add_track', result.call)
     error = 'Track already exists' # TODO: i18n
     self.assertEqual(error, result.data)
Пример #8
0
 def test_add_track_fails_when_track_found(self):
     # Arrange
     track = Track.objects.create(name='bogus track',
                                  distance=50,
                                  timeout=100,
                                  unit_of_measurement=settings.METRIC)
     # Act
     result = api_track.add_track(track.name, track.distance, track.timeout,
                                  track.unit_of_measurement)
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('add_track', result.call)
     error = 'Track already exists'  # TODO: i18n
     self.assertEqual(error, result.data)
Пример #9
0
from django.conf import settings
from laptimer import api_lap, \
      api_rider, \
      api_session, \
      api_track
#api_sensor, \
from laptimer.models import Lap, \
                            Rider, \
                            Session, \
                            Sensor, \
                            SensorEvent, \
                            Track
import logging

logger = logging.getLogger('laptimer')

# Create test data via api, assumes db is flushed
riderBetty = api_rider.add_rider(rider_name='Bodacious Betty').data
riderBob = api_rider.add_rider(rider_name='Bogus Bob').data
track = api_track.add_track(track_name='Test Track',
                            track_distance=50,
                            lap_timeout=100,
                            unit_of_measurement=settings.METRIC).data
session = api_session.add_session(track.name, 'Test Session').data
# sensorStart = api_sensor.add_sensor()
# sensorFinish = api_sensor.add_sensor()
# sensorStartFinish = api_sensor.add_sensor()
# riderBettyLap1 = api_lap.add_lap()
# riderBobLap1 = api_lap.add_lap()
Пример #10
0
from django.conf import settings
from laptimer import api_lap, \
					 api_rider, \
					 api_session, \
					 api_track
					 #api_sensor, \
from laptimer.models import Lap, \
                            Rider, \
                            Session, \
                            Sensor, \
                            SensorEvent, \
                            Track
import logging


logger = logging.getLogger('laptimer')

# Create test data via api, assumes db is flushed
riderBetty = api_rider.add_rider(rider_name='Bodacious Betty').data
riderBob = api_rider.add_rider(rider_name='Bogus Bob').data
track = api_track.add_track(track_name='Test Track', track_distance=50, 
	lap_timeout=100, unit_of_measurement=settings.METRIC).data
session = api_session.add_session(track.name, 'Test Session').data
# sensorStart = api_sensor.add_sensor()
# sensorFinish = api_sensor.add_sensor()
# sensorStartFinish = api_sensor.add_sensor()
# riderBettyLap1 = api_lap.add_lap()
# riderBobLap1 = api_lap.add_lap()