예제 #1
0
    def test_get_london_weather(self):
        weather = get_weather("London")

        self.assertEqual(weather['body']['name'], 'London')
        self.assertEqual(weather['body']['main']['temp'], 284.69)
        self.assertEqual(weather['body']['main']['temp_max'], 286.48)
        self.assertEqual(weather['body']['main']['temp_min'], 283.15)
예제 #2
0
 def open(self):
     print('websocket opened!')
     # send them weather
     weather = get_weather()
     self.write_message({
         'command': 'load-weather',
         'data': weather,
     })
     # send them events
     (js_events, js_datetime_retrieved) = db.get_js_events()
     self.write_message({
         'command': 'load-events',
         'events': js_events,
         'updated': js_datetime_retrieved,
     })
예제 #3
0
 def test_get_weather(self):
     weather = main.get_weather()
     self.assertEqual(len(weather), 1)
예제 #4
0
def test_get_weather():
    assert (isinstance(get_weather(), dict) == True)
예제 #5
0
def test_get_weather():
    assert get_weather()==[{"title": "Weather in Exeter", "content": "Temperature: 5.5\u00b0C, Condition: Clouds, Pressure: 981, Humidity: 87"}]