Skip to content
Permalink
Browse files

Fix Darksky tests

  • Loading branch information...
rohankapoorcom committed Feb 10, 2019
1 parent dcc6881 commit a73384a223ba8a93c682042d9351cd5a7a399183
Showing with 3 additions and 6 deletions.
  1. +1 −1 homeassistant/components/sensor/darksky.py
  2. +2 −5 tests/components/sensor/test_darksky.py
@@ -209,7 +209,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up the Dark Sky sensor."""
latitude = config.get(CONF_LATITUDE, hass.config.latitude)
longitude = config.get(CONF_LONGITUDE, hass.config.longitude)
language = config.get(CONF_LANGUAGE)
language = config[CONF_LANGUAGE]
interval = config[CONF_SCAN_INTERVAL]

if CONF_UNITS in config:
@@ -1,15 +1,14 @@
"""The tests for the Dark Sky platform."""
import re
import unittest
from unittest.mock import MagicMock, patch
from unittest.mock import patch
from datetime import timedelta

from requests.exceptions import HTTPError
import requests_mock

import forecastio

from homeassistant.components.sensor import darksky
from homeassistant.setup import setup_component

from tests.common import (load_fixture, get_test_home_assistant,
@@ -138,9 +137,7 @@ def test_setup_bad_api_key(self, mock_get_forecast):
msg = '400 Client Error: Bad Request for url: {}'.format(url)
mock_get_forecast.side_effect = HTTPError(msg,)

response = darksky.setup_platform(self.hass, VALID_CONFIG_MINIMAL,
MagicMock())
assert not response
assert setup_component(self.hass, 'sensor', VALID_CONFIG_MINIMAL)

@requests_mock.Mocker()
@patch('forecastio.api.get_forecast', wraps=forecastio.api.get_forecast)

0 comments on commit a73384a

Please sign in to comment.
You can’t perform that action at this time.