예제 #1
0
 def test_remove_session_fails_when_track_not_found(self):
     # Arrange & Act
     result = api_session.remove_session('bogus track', 'bogus session')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('remove_session', result.call)
     error = 'Track not found' # TODO: i18n
     self.assertEqual(error, result.data)
예제 #2
0
 def test_remove_session_fails_when_session_not_found(self):
     # Arrange
     track = Track.objects.create(name='bogus track', distance=50,
         timeout=100, unit_of_measurement=settings.METRIC)
     # Act
     result = api_session.remove_session(track.name, 'bogus session')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('remove_session', result.call)
     error = 'Session not found' # TODO: i18n
     self.assertEqual(error, result.data)
예제 #3
0
 def test_remove_session_passes(self):
     # Arrange
     track = Track.objects.create(name='bogus track', distance=50,
         timeout=100, unit_of_measurement=settings.METRIC)
     session_name = 'bogus session'
     session = Session.objects.create(name=session_name, track=track)
     # Act
     result = api_session.remove_session(track.name, session_name)
     # Assert
     self.assertFalse(Session.objects.filter(name=session_name).exists())
     self.assertTrue(result.ok)
     self.assertEqual('remove_session', result.call)
     self.assertEqual(session_name, result.data)