Fix flakiness in tests (#12806)
This commit is contained in:
1 parent
ff83efe376
commit
23c39ebefd
3 files changed
+18
-18
No files matched your search
@@ -132,13 +132,15 @@ class TestDdwrt(unittest.TestCase):
|
||||
to the DD-WRT Lan Status request response fixture.
|
||||
This effectively checks the data parsing functions.
|
||||
"""
|
||||
status_lan = load_fixture('Ddwrt_Status_Lan.txt')
|
||||
|
||||
with requests_mock.Mocker() as mock_request:
|
||||
mock_request.register_uri(
|
||||
'GET', r'http://%s/Status_Wireless.live.asp' % TEST_HOST,
|
||||
text=load_fixture('Ddwrt_Status_Wireless.txt'))
|
||||
mock_request.register_uri(
|
||||
'GET', r'http://%s/Status_Lan.live.asp' % TEST_HOST,
|
||||
text=load_fixture('Ddwrt_Status_Lan.txt'))
|
||||
text=status_lan)
|
||||
|
||||
with assert_setup_component(1, DOMAIN):
|
||||
assert setup_component(
|
||||
@@ -153,12 +155,8 @@ class TestDdwrt(unittest.TestCase):
|
||||
path = self.hass.config.path(device_tracker.YAML_DEVICES)
|
||||
devices = config.load_yaml_config_file(path)
|
||||
for device in devices:
|
||||
self.assertIn(
|
||||
devices[device]['mac'],
|
||||
load_fixture('Ddwrt_Status_Lan.txt'))
|
||||
self.assertIn(
|
||||
slugify(devices[device]['name']),
|
||||
load_fixture('Ddwrt_Status_Lan.txt'))
|
||||
self.assertIn(devices[device]['mac'], status_lan)
|
||||
self.assertIn(slugify(devices[device]['name']), status_lan)
|
||||
|
||||
def test_device_name_no_data(self):
|
||||
"""Test creating device info (MAC only) when no response."""
|
||||
@@ -181,11 +179,10 @@ class TestDdwrt(unittest.TestCase):
|
||||
|
||||
path = self.hass.config.path(device_tracker.YAML_DEVICES)
|
||||
devices = config.load_yaml_config_file(path)
|
||||
status_lan = load_fixture('Ddwrt_Status_Lan.txt')
|
||||
for device in devices:
|
||||
_LOGGER.error(devices[device])
|
||||
self.assertIn(
|
||||
devices[device]['mac'],
|
||||
load_fixture('Ddwrt_Status_Lan.txt'))
|
||||
self.assertIn(devices[device]['mac'], status_lan)
|
||||
|
||||
def test_device_name_no_dhcp(self):
|
||||
"""Test creating device info (MAC) when missing dhcp response."""
|
||||
@@ -210,11 +207,10 @@ class TestDdwrt(unittest.TestCase):
|
||||
|
||||
path = self.hass.config.path(device_tracker.YAML_DEVICES)
|
||||
devices = config.load_yaml_config_file(path)
|
||||
status_lan = load_fixture('Ddwrt_Status_Lan.txt')
|
||||
for device in devices:
|
||||
_LOGGER.error(devices[device])
|
||||
self.assertIn(
|
||||
devices[device]['mac'],
|
||||
load_fixture('Ddwrt_Status_Lan.txt'))
|
||||
self.assertIn(devices[device]['mac'], status_lan)
|
||||
|
||||
def test_update_no_data(self):
|
||||
"""Test error handling of no response when active devices checked."""
|
||||
|
||||
Reference in new issue
Block a user