def test_can_get_color_for_temperatures(self):
     adptr = WeatherAdapter(MockWeatherData())
     for x in range(-50,50):
         color = adptr.get_color_for_temperature(x)
         self.assertIsNotNone(color)
         self.assertTrue(color[0] >= 0 and color[0] <= 255)
         self.assertTrue(color[1] >= 0 and color[1] <= 255)
         self.assertTrue(color[1] >= 0 and color[1] <= 255)
 def test_no_precip_no_flashing(self):
     data = MockWeatherData()
     data.refresh()
     data.weather_data['currently']['precipIntensity'] = 0
     data.weather_data['daily']['precipPropbability'] = 0
     adptr = WeatherAdapter(data)
     settings = LightSettings()
     adptr.apply_to_settings(settings)
     self.assertTrue(settings.next_settings is None)
     self.assertTrue(settings.transition_time is None)
 def test_active_precip_max_red(self):
     data = MockWeatherData()
     data.refresh()
     data.weather_data['currently']['precipIntensity'] = 3
     data.weather_data['daily']['data'][0]['precipProbability'] = 0
     adptr = WeatherAdapter(data)
     settings = LightSettings()
     adptr.apply_to_settings(settings)
     self.assertTrue(settings.next_settings is not None)
     self.assertEquals(4, settings.on_duration)
     self.assertEquals(255, settings.next_settings.red)
Beispiel #4
0
 def _apply_settings(self, settings):
     super(Weather, self)._apply_settings(settings)
     data = WeatherData()
     adapter = WeatherAdapter(data)
     adapter.apply_to_settings(settings)