This commit is contained in:
Paulus Schoutsen committed 2019-07-31 12:25:30 -07:00
1 parent da05dfe708
commit 4de97abc3a
2676 files changed
+163166 -140084

No files matched your search

@@ -12,10 +12,10 @@ class TestOpenHardwareMonitorSetup(unittest.TestCase):
"""Initialize values for this testcase class."""
self.hass = get_test_home_assistant()
self.config = {
'sensor': {
'platform': 'openhardwaremonitor',
'host': 'localhost',
'port': 8085
"sensor": {
"platform": "openhardwaremonitor",
"host": "localhost",
"port": 8085,
}
}
@@ -26,15 +26,18 @@ class TestOpenHardwareMonitorSetup(unittest.TestCase):
@requests_mock.Mocker()
def test_setup(self, mock_req):
"""Test for successfully setting up the platform."""
mock_req.get('http://localhost:8085/data.json',
text=load_fixture('openhardwaremonitor.json'))
mock_req.get(
"http://localhost:8085/data.json",
text=load_fixture("openhardwaremonitor.json"),
)
assert setup_component(self.hass, 'sensor', self.config)
entities = self.hass.states.async_entity_ids('sensor')
assert setup_component(self.hass, "sensor", self.config)
entities = self.hass.states.async_entity_ids("sensor")
assert len(entities) == 38
state = self.hass.states.get(
'sensor.test_pc_intel_core_i7_7700_clocks_bus_speed')
"sensor.test_pc_intel_core_i7_7700_clocks_bus_speed"
)
assert state is not None
assert state.state == '100'
assert state.state == "100"