예제 #1
0
def check_forecast(self, s):
    """
    checks the weather forecast for the next 7 days.
    -- Examples:
        check forecast
        check forecast in Madrid
    """
    forecast.main(self, s)
예제 #2
0
 def test_header_as_expected_with_location(self, print_say_mock):
     with patch.object(requests, 'get',
                       return_value=MyResponse) as get_mock:
         forecast.main(self.CI_instance, 'check forecast in New York')
         get_mock.assert_called_with(
             "http://api.openweathermap.org/data/2.5/forecast/daily?q={0}&cnt={1}"
             "&APPID=ab6ec687d641ced80cc0c935f9dd8ac9&units={2}".format(
                 'New York', '7', self.units['url_units']))
예제 #3
0
def check_forecast(self, s):
    """
    checks the weather forecast for the next 7 days.
    -- Examples:
        check forecast
        check forecast in Madrid
    """
    forecast.main(self, s)
예제 #4
0
 def test_header_as_expected_when_no_location(self, print_say_mock):
     my_city_and_country = "{},{}".format(
         self.current_location['city'],
         self.current_location['country_code'])
     with patch.object(requests, 'get',
                       return_value=MyResponse) as get_mock:
         forecast.main(self.CI_instance, 'check forecast')
         get_mock.assert_called_with(
             "http://api.openweathermap.org/data/2.5/forecast/daily?q={0}&cnt={1}"
             "&APPID=ab6ec687d641ced80cc0c935f9dd8ac9&units={2}".format(
                 my_city_and_country, '7', self.units['url_units']))
예제 #5
0
 def test_forecast_formatted_as_expected(self, print_say_mock):
     with patch.object(requests, 'get',
                       return_value=MyResponse) as get_mock:
         forecast.main(self.CI_instance, 'Some location')
         last_call = call(
             "\tMin temperature: {} {}\n".format('17.0',
                                                 self.units['str_units']),
             self.CI_instance, Fore.BLUE)
         third_call = call("\tWeather: {}".format('Clear'),
                           self.CI_instance, Fore.BLUE)
         self.assertEqual(last_call, print_say_mock.mock_calls[-1])
         self.assertEqual(third_call, print_say_mock.mock_calls[2])
예제 #6
0
 def do_check(self, s):
     """Checks your system's RAM stats."""
     # if s == "ram":
     if "ram" in s:
         system("free -lm")
     # if s == "time"
     elif "time" in s:
         timeIn.main(self, s)
     elif "forecast" in s:
         forecast.main(self, s)
     # if s == "weather"
     elif "weather" in s:
         weatherIn.main(self, s)
예제 #7
0
 def do_check(self, s):
     """Checks your system's RAM stats."""
     # if s == "ram":
     if "ram" in s:
         system("free -lm")
     # if s == "time"
     elif "time" in s:
         timeIn.main(self, s)
     elif "forecast" in s:
         forecast.main(self, s)
     # if s == "weather"
     elif "weather" in s:
         try:
             weatherIn.main(self, s)
         except ConnectionError:
             print(CONNECTION_ERROR_MSG)