def test_to_business_info_00(self, mocker): """Ensure the collector functions are called.""" c = CollectorClient(self.fake.pystr()) c.collector = mocker.Mock() c.to_business_info() c.collector.to_business_info.assert_called()
def integration_test_full_google_yelp_workflow_with_generic(): """""" places_api_key = os.environ['RYR_COLLECTOR_GOOGLE_PLACES_API_KEY'] yelp_api_key = os.environ['RYR_COLLECTOR_YELP_API_KEY'] # Simulate a click Epoch Coffee Shop - Northloop on the map. epoch_latlong = (30.3186037, -97.72454019999999) epoch_latlong = (30.319136, -97.724303) # Retrieve the places nearby the location clicked on the map. gmap = GoogleCollector() gmap.authenticate(api_key=places_api_key) places_nearby = gmap.search_places_nearby(epoch_latlong) # Act like a user chose Epoch Coffee Shop - Northloop in the result list. epoch_search_summary = gmap.retrieve_search_summary(1) print(epoch_search_summary) # Lookup the place on Google Maps. google = CollectorClient('google', api_key=places_api_key) google.authenticate() google_place_details = google.lookup_place(epoch_search_summary.place_id) gb = google.to_business_info() print('*** Google:') print(gb) # Lookup the place on Yelp. yelp = CollectorClient('yelp', api_key=yelp_api_key, weight=10) yelp.authenticate() yelp_place_details = yelp.lookup_place(None, epoch_search_summary.name, epoch_search_summary.address) yb = yelp.to_business_info() print('*** Yelp:') print(yb) # Merge the results. print('*** Merged:') print(gb.merge(yb))