Move imports to top for nsw_fuel_station (#29538)
* Move imports to top for nsw_fuel_station * Correct patch path in test_sensor.py * Fix tests by removing the unused argument mock_nsw_fuel
This commit is contained in:
1 parent
425a1814d9
commit
202522fbca
2 files changed
+13
-10
No files matched your search
@@ -4,7 +4,7 @@ from unittest.mock import patch
|
||||
|
||||
from homeassistant.components import sensor
|
||||
from homeassistant.setup import setup_component
|
||||
from tests.common import get_test_home_assistant, assert_setup_component, MockDependency
|
||||
from tests.common import get_test_home_assistant, assert_setup_component
|
||||
|
||||
VALID_CONFIG = {
|
||||
"platform": "nsw_fuel_station",
|
||||
@@ -83,9 +83,11 @@ class TestNSWFuelStation(unittest.TestCase):
|
||||
"""Stop everything that was started."""
|
||||
self.hass.stop()
|
||||
|
||||
@MockDependency("nsw_fuel")
|
||||
@patch("nsw_fuel.FuelCheckClient", new=FuelCheckClientMock)
|
||||
def test_setup(self, mock_nsw_fuel):
|
||||
@patch(
|
||||
"homeassistant.components.nsw_fuel_station.sensor.FuelCheckClient",
|
||||
new=FuelCheckClientMock,
|
||||
)
|
||||
def test_setup(self):
|
||||
"""Test the setup with custom settings."""
|
||||
with assert_setup_component(1, sensor.DOMAIN):
|
||||
assert setup_component(self.hass, sensor.DOMAIN, {"sensor": VALID_CONFIG})
|
||||
@@ -96,9 +98,11 @@ class TestNSWFuelStation(unittest.TestCase):
|
||||
state = self.hass.states.get("sensor.{}".format(entity_id))
|
||||
assert state is not None
|
||||
|
||||
@MockDependency("nsw_fuel")
|
||||
@patch("nsw_fuel.FuelCheckClient", new=FuelCheckClientMock)
|
||||
def test_sensor_values(self, mock_nsw_fuel):
|
||||
@patch(
|
||||
"homeassistant.components.nsw_fuel_station.sensor.FuelCheckClient",
|
||||
new=FuelCheckClientMock,
|
||||
)
|
||||
def test_sensor_values(self):
|
||||
"""Test retrieval of sensor values."""
|
||||
assert setup_component(self.hass, sensor.DOMAIN, {"sensor": VALID_CONFIG})
|
||||
|
||||
|
||||
Reference in new issue
Block a user