def test_save_calls_get_venue_coords(self): api_url_re = re.compile('https://api.mapbox.com/geocoding/(.*)') data_json = { 'features': [{ 'geometry': { 'coordinates': ['123.456', '321.654'] } }] } responses.add(responses.GET, api_url_re, json=data_json) page = EventPage(title='Super fun event', venue_city='Boston', venue_state='MA') save_new_page(page) self.assertEqual(page.venue_coords, '123.456,321.654') self.assertIn('static/123.456,321.654', page.location_image_url())
def test_save_calls_get_venue_coords(self): api_url_re = re.compile('https://api.mapbox.com/geocoding/(.*)') data_json = { 'features': [{ 'geometry': { 'coordinates': [ '123.456', '321.654' ] } }] } responses.add(responses.GET, api_url_re, json=data_json) page = EventPage( title='Super fun event', venue_city='Boston', venue_state='MA' ) save_new_page(page) self.assertEqual(page.venue_coords, '123.456,321.654') self.assertIn('static/123.456,321.654', page.location_image_url())
def test_venue_coords_without_saving(self): page = EventPage(title='Party time') # Should get static image URL even if page hasn't been saved self.assertIn('static/-77.039628,38.898238', page.location_image_url())