Collection of tests improvements (#33778)

This commit is contained in:
Franck Nijhof 2020-04-07 18:36:35 +02:00 committed by GitHub
parent bee742994e
commit bb8bbc9c54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 342 additions and 286 deletions

View file

@ -95,7 +95,7 @@ class TestShellCommand(unittest.TestCase):
self.hass.block_till_done()
cmd = mock_call.mock_calls[0][1][0]
assert 1 == mock_call.call_count
assert mock_call.call_count == 1
assert "ls /bin" == cmd
@patch(
@ -121,7 +121,7 @@ class TestShellCommand(unittest.TestCase):
self.hass.block_till_done()
cmd = mock_call.mock_calls[0][1]
assert 1 == mock_call.call_count
assert mock_call.call_count == 1
assert ("ls", "/bin", "Works") == cmd
@patch(
@ -143,8 +143,8 @@ class TestShellCommand(unittest.TestCase):
self.hass.services.call("shell_command", "test_service", blocking=True)
self.hass.block_till_done()
assert 1 == mock_call.call_count
assert 1 == mock_error.call_count
assert mock_call.call_count == 1
assert mock_error.call_count == 1
assert not os.path.isfile(path)
@patch("homeassistant.components.shell_command._LOGGER.debug")
@ -160,7 +160,7 @@ class TestShellCommand(unittest.TestCase):
self.hass.services.call("shell_command", "test_service", blocking=True)
self.hass.block_till_done()
assert 1 == mock_output.call_count
assert mock_output.call_count == 1
assert test_phrase.encode() + b"\n" == mock_output.call_args_list[0][0][-1]
@patch("homeassistant.components.shell_command._LOGGER.debug")
@ -176,5 +176,5 @@ class TestShellCommand(unittest.TestCase):
self.hass.services.call("shell_command", "test_service", blocking=True)
self.hass.block_till_done()
assert 1 == mock_output.call_count
assert mock_output.call_count == 1
assert test_phrase.encode() + b"\n" == mock_output.call_args_list[0][0][-1]