def test__weahter_data_is_valid_data_is_invalid(self): """ Should return False :return: """ collector = TemperatureFromOpenWeatherDotCom(parameters={ 'countrycode': 'ger', 'apikey': '123456789abcdefghijkl1234567890a', 'city': 'Munich' }, parent=None) class FunkyHTTPResponseMockup(): @staticmethod def getcode(): return 401 actual_data = FunkyHTTPResponseMockup() try: logging.disable(logging.ERROR) actual_result = collector._weather_data_is_valid(actual_data) finally: logging.disable(logging.NOTSET) self.assertFalse(actual_result)
def test__weather_data_is_valid(self): """ Should return True :return: """ collector = TemperatureFromOpenWeatherDotCom(parameters={ 'countrycode': 'ger', 'apikey': '123456789abcdefghijkl1234567890a', 'city': 'Munich' }, parent=None) class FunkyHTTPResponseMockup(): @staticmethod def getcode(): return 200 actual_data = FunkyHTTPResponseMockup() actual_result = collector._weather_data_is_valid(actual_data) self.assertTrue(actual_result)