'Test for handling a bad API key.'

@patch('forecastio.api.get_forecast')
def test_setup_bad_api_key(self, mock_get_forecast):

    url = 'https://api.darksky.net/forecast/{}/{},{}?units=auto'.format(self.key, str(self.lat), str(self.lon))
    msg = '400    Client    Error:    Bad    Request    for    url:    {}'.format(url)
    mock_get_forecast.side_effect = HTTPError(msg)
    response = darksky.setup_platform(self.hass, self.config, MagicMock())
    self.assertFalse(response)
