Beispiel #1
0
 def test_get_sessions_fails_when_track_not_found(self):
     # Arrange
     # Act
     result = api_session.get_sessions('nope')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('get_sessions', result.call)
     error = 'Track not found' # TODO: i18n
     self.assertEqual(error, result.data)
Beispiel #2
0
 def test_get_sessions_passes(self):
     # Arrange
     track = Track.objects.create(name='bogus track', distance=50,
         timeout=100, unit_of_measurement=settings.METRIC)
     session1 = Session.objects.create(name='bogus session 1', track=track)
     session2 = Session.objects.create(name='bogus session 2', track=track)
     # Act
     result = api_session.get_sessions(track.name)
     # Assert
     self.assertTrue(result.ok)
     self.assertEqual('get_sessions', result.call)
     self.assertEqual(2, result.data.count())
     self.assertEqual(session1, result.data[0])
     self.assertEqual(session2, result.data[1])