def test_weather_operations(self):
     mock_weather = cmpd_accidents.WeatherService(
         endpoint='http://samples.openweathermap.org/data/2.5/weather',
         apiKey='b6907d289e10d714a6e88b30761fae22'
     )  # fake API key via OpenWeatherAPI
     results = mock_weather.get(params={'lat': 35, 'lon': 139})
     self.assertTrue(results is not None)
 def test_weather_init(self):
     mock_weather = cmpd_accidents.WeatherService(
         endpoint='http://samples.openweathermap.org/data/2.5/weather',
         apiKey='b6907d289e10d714a6e88b30761fae22'
     )  # fake API key via OpenWeatherAPI
     self.assertTrue(type(mock_weather) == cmpd_accidents.WeatherService)
     self.assertTrue(hasattr(mock_weather, '__init__'))
     self.assertTrue(hasattr(mock_weather, 'get'))
 def test_weather_sanity_check(self, WeatherMock):
     WeatherMock.return_value.get.return_value = "test"
     mock = cmpd_accidents.WeatherService(
         endpoint='http://samples.openweathermap.org/data/2.5/weather',
         apiKey='b6907d289e10d714a6e88b30761fae22'
     )  # fake API key via OpenWeatherAPI
     result = mock.get(params={'lat': 35, 'lon': 139})
     self.assertTrue(WeatherMock is cmpd_accidents.WeatherService)
     self.assertEqual(result, "test")
 def setUpClass(self):
     """ Setup """
     # REST
     endpoint = 'https://cmpdinfo.charlottenc.gov/api/v2/traffic'
     mock_rest = cmpd_accidents.RestService(endpoint)
     # DB
     mock_db = cmpd_accidents.MongoDBConnect("localhost")
     # Weather
     weather = cmpd_accidents.WeatherService(
         endpoint='https://samples.openweathermap.org/data/2.5/weather',
         apiKey='b6907d289e10d714a6e88b30761fae22'
     )  # fake API key via OpenWeatherAPI
     # CMPD
     self.mock_cmpd = cmpd_accidents.CMPDService(
         mock_db, mock_rest, weather)
 def test_cmpd_service_update(self, DBMock):
     """ Test mock db for integration """
     # REST
     endpoint = 'https://cmpdinfo.charlottenc.gov/api/v2/traffic'
     mock_rest = cmpd_accidents.RestService(endpoint)
     # DB
     mock_db = cmpd_accidents.MongoDBConnect("localhost")
     # Weather
     weather = cmpd_accidents.WeatherService(
         endpoint='https://samples.openweathermap.org/data/2.5/weather',
         apiKey='b6907d289e10d714a6e88b30761fae22'
     )  # fake API key via OpenWeatherAPI
     # CMPD
     mock_cmpd = cmpd_accidents.CMPDService(mock_db, mock_rest, weather)
     self.assertTrue(hasattr(mock_cmpd, "update_traffic_data"))
     mock_cmpd.update_traffic_data()