mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Fix yr test
This commit is contained in:
parent
d69c1b848a
commit
3db6faab4d
@ -4,12 +4,14 @@ tests.components.sensor.test_yr
|
|||||||
|
|
||||||
Tests Yr sensor.
|
Tests Yr sensor.
|
||||||
"""
|
"""
|
||||||
|
from datetime import datetime
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import homeassistant.core as ha
|
import homeassistant.core as ha
|
||||||
import homeassistant.components.sensor as sensor
|
import homeassistant.components.sensor as sensor
|
||||||
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures('betamax_session')
|
@pytest.mark.usefixtures('betamax_session')
|
||||||
@ -26,8 +28,12 @@ class TestSensorYr:
|
|||||||
self.hass.stop()
|
self.hass.stop()
|
||||||
|
|
||||||
def test_default_setup(self, betamax_session):
|
def test_default_setup(self, betamax_session):
|
||||||
|
now = datetime(2016, 1, 5, 1, tzinfo=dt_util.UTC)
|
||||||
|
|
||||||
with patch('homeassistant.components.sensor.yr.requests.Session',
|
with patch('homeassistant.components.sensor.yr.requests.Session',
|
||||||
return_value=betamax_session):
|
return_value=betamax_session):
|
||||||
|
with patch('homeassistant.components.sensor.yr.dt_util.utcnow',
|
||||||
|
return_value=now):
|
||||||
assert sensor.setup(self.hass, {
|
assert sensor.setup(self.hass, {
|
||||||
'sensor': {
|
'sensor': {
|
||||||
'platform': 'yr',
|
'platform': 'yr',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user