Esempio n. 1
0
 def test_change_rider_fails_when_rider_not_found(self):
     # Arrange & Act
     result = api_rider.change_rider('bogus rider', 'none')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('change_rider', result.call)
     error = 'Rider not found' # TODO: i18n
     self.assertEqual(error, result.data)
Esempio n. 2
0
 def test_change_rider_fails_when_rider_not_found(self):
     # Arrange & Act
     result = api_rider.change_rider('bogus rider', 'none')
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('change_rider', result.call)
     error = 'Rider not found'  # TODO: i18n
     self.assertEqual(error, result.data)
Esempio n. 3
0
 def test_change_rider_fails_when_new_rider_found(self):
     # Arrange
     rider = Rider.objects.create(name='bogus rider')
     # Act
     result = api_rider.change_rider('none', rider.name)
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('change_rider', result.call)
     error = 'Rider already exists' # TODO: i18n
     self.assertEqual(error, result.data)
Esempio n. 4
0
 def test_change_rider_fails_when_new_rider_found(self):
     # Arrange
     rider = Rider.objects.create(name='bogus rider')
     # Act
     result = api_rider.change_rider('none', rider.name)
     # Assert
     self.assertFalse(result.ok)
     self.assertEqual('change_rider', result.call)
     error = 'Rider already exists'  # TODO: i18n
     self.assertEqual(error, result.data)
Esempio n. 5
0
 def test_change_rider_passes(self):
     # Arrange
     first_name = 'bogus rider'
     changed_name = 'betty boo'
     Rider.objects.create(name=first_name)
     # Act
     result = api_rider.change_rider(first_name, changed_name)
     # Assert
     self.assertTrue(Rider.objects.filter(name=changed_name).exists())
     self.assertTrue(result.ok)
     self.assertEqual('change_rider', result.call)
     rider = Rider.objects.get(name=changed_name)
     self.assertEqual(rider, result.data)
Esempio n. 6
0
 def test_change_rider_passes(self):
     # Arrange
     first_name = 'bogus rider'
     changed_name = 'betty boo'
     Rider.objects.create(name=first_name)
     # Act
     result = api_rider.change_rider(first_name, changed_name)
     # Assert
     self.assertTrue(Rider.objects.filter(name=changed_name).exists())
     self.assertTrue(result.ok)
     self.assertEqual('change_rider', result.call)
     rider = Rider.objects.get(name=changed_name)
     self.assertEqual(rider, result.data)