def test_get_nearest_airport(self): handler = AnalysisEngineAPIHandlerHTTP(attempts=3) handler._request = Mock() request_return_value = { "status": 200, "airport": { "distance": 1.5125406009017226, "magnetic_variation": "W002241 0106", "code": { "icao":"EGLL", "iata":"LHR" }, "name":"London Heathrow", "longitude":-0.461389, "location": { "city":"London", "country":"United Kingdom" }, "latitude":51.4775, "id":2383 } } handler._request.return_value = request_return_value self.assertEqual(handler.get_nearest_airport(14.1, 0.52), request_return_value['airport'])
def test_get_nearest_airport(self): handler = AnalysisEngineAPIHandlerHTTP(attempts=3) handler._request = Mock() request_return_value = { "status": 200, "airport": { "distance": 1.5125406009017226, "magnetic_variation": "W002241 0106", "code": { "icao": "EGLL", "iata": "LHR" }, "name": "London Heathrow", "longitude": -0.461389, "location": { "city": "London", "country": "United Kingdom" }, "latitude": 51.4775, "id": 2383 } } handler._request.return_value = request_return_value self.assertEqual(handler.get_nearest_airport(14.1, 0.52), request_return_value['airport'])
def test_get_nearest_airport_integration(self): ''' Make an HTTP request rather than mocking the response. Requires the BASE_URL server being online. ''' handler = AnalysisEngineAPIHandlerHTTP(attempts=3) self.assertEqual(handler.get_nearest_airport(51.4775, -0.461389), {'code': {'iata': 'LHR', 'icao': 'EGLL'}, 'id': 2383, 'latitude': 51.4775, 'location': { 'city': 'London', 'country': 'United Kingdom' }, 'longitude': -0.461389, 'magnetic_variation': 'W002241 0106', 'name': 'London Heathrow'})
def test_get_nearest_airport_integration(self): ''' Make an HTTP request rather than mocking the response. Requires the BASE_URL server being online. ''' handler = AnalysisEngineAPIHandlerHTTP(attempts=3) self.assertEqual( handler.get_nearest_airport(51.4775, -0.461389), { 'code': { 'iata': 'LHR', 'icao': 'EGLL' }, 'id': 2383, 'latitude': 51.4775, 'location': { 'city': 'London', 'country': 'United Kingdom' }, 'longitude': -0.461389, 'magnetic_variation': 'W002241 0106', 'name': 'London Heathrow' })
def test_get_nearest_runway(self): handler = AnalysisEngineAPIHandlerHTTP(attempts=3) handler._request = Mock() handler._request.return_value = {'status': 200, 'runway': {'end': 1}} self.assertEqual(handler.get_nearest_runway('ICAO', 120), {'end': 1})