Esempio n. 1
0
 def test_get_location_from_user_timeline(self):
     """Testing getting a location from twitter account's recent tweets"""
     fallback = models.WeatherLocation(55.76, 12.49, 'Lyngby-Taarbæk, Hovedstaden')
     morris = models.WeatherLocation(45.58605, -95.91405, 'Morris, MN')
     loc = weatherBot.get_location_from_user_timeline('MorrisMNWeather', fallback)
     self.assertTrue(type(loc) is models.WeatherLocation)
     self.assertEqual(loc, morris)
     self.assertEqual(weatherBot.get_location_from_user_timeline('twitter', fallback), fallback)
Esempio n. 2
0
 def test_get_location_from_user_timeline_place(self):
     """Testing getting a location from twitter account's recent tweets using the place bounding box"""
     fallback_loc = models.WeatherLocation(4, 3, 'test')
     test_loc = models.WeatherLocation(5.0, 4.0, 'cool place')
     loc = weatherBot.get_location_from_user_timeline('nocoords', fallback_loc)
     self.assertTrue(type(loc) is models.WeatherLocation)
     self.assertEqual(loc, test_loc)
Esempio n. 3
0
 def test_get_location_from_user_timeline_coordinates(self):
     """Testing getting a location from twitter account's recent tweets using the coordinates property"""
     fallback_loc = models.WeatherLocation(4, 3, 'test')
     test_loc = models.WeatherLocation(2, 1, 'test')
     loc = weatherBot.get_location_from_user_timeline('MorrisMNWeather', fallback_loc)
     self.assertTrue(type(loc) is models.WeatherLocation)
     self.assertEqual(loc, test_loc)
Esempio n. 4
0
 def test_get_location_from_user_timeline_empty(self):
     """Testing getting a location from twitter account's recent tweets when there are none"""
     fallback_loc = models.WeatherLocation(4, 3, 'test')
     self.assertEqual(
         weatherBot.get_location_from_user_timeline('no tweets',
                                                    fallback_loc),
         fallback_loc)
Esempio n. 5
0
 def test_get_location_from_user_timeline_coordinates_no_place_full_name(self):
     """Testing getting a location from twitter account's recent tweets using the coordinates property
      when a place does not exist for that location"""
     fallback_loc = models.WeatherLocation(4, 3, 'test')
     test_loc = models.WeatherLocation(2.5, 1.5, 'unnamed location')
     weatherBot.CONFIG['variable_location']['unnamed_location_name'] = 'unnamed location'
     loc = weatherBot.get_location_from_user_timeline('coordsnoplace', fallback_loc)
     self.assertTrue(type(loc) is models.WeatherLocation)
     self.assertEqual(loc, test_loc)