def test_from_london_to_paris(self, mockk): calculator = FlightCalculator('london', ['paris']) flights = list(calculator.process()) self.assertEqual(1, len(flights)) self.assertEqual([self.flight1], flights)
def test_nonexistent_destination_city(self, mockk): with self.assertRaises(NoSuchCity) as ex_context: list(FlightCalculator('london', ['abra_cadabra']).process()) self.assertEqual(ex_context.exception.args[0], 'abra_cadabra city not found')
def test_empty_departure(self, mockk): with self.assertRaises(NoSuchCity) as ex_context: list(FlightCalculator('', ['paris']).process()) self.assertEqual(ex_context.exception.args[0], ' city not found')
def test_empty_destination(self, mockk): with self.assertRaises(NoDestinationCitiesProvided): list(FlightCalculator('london', []).process())
def test_with_several_destination_cities(self, mockk): calculator = FlightCalculator('london', ['paris', 'berlin']) flights = list(calculator.process()) self.assertEqual(2, len(flights)) self.assertEqual([self.flight1, self.flight2], flights)