def test_run_webdriver_manager(self): expected_commands = [ common.NODE_BIN_PATH, run_e2e_tests.WEBDRIVER_MANAGER_BIN_PATH, 'start', '--detach' ] def mock_popen(unused_command): class Ret(python_utils.OBJECT): """Return object with required attributes.""" def __init__(self): self.returncode = 0 def communicate(self): """Return required method.""" return '', '' return Ret() popen_swap = self.swap_with_checks(subprocess, 'Popen', mock_popen, expected_args=[(expected_commands, ) ], expected_kwargs=[{}]) with popen_swap: run_e2e_tests.run_webdriver_manager(['start', '--detach'])
def test_run_webdriver_manager(self): expected_commands = [ common.NODE_BIN_PATH, run_e2e_tests.WEBDRIVER_MANAGER_BIN_PATH, 'start', '--detach'] stdout = 'stdout' def mock_run_cmd(unused_commands): return stdout mock_run_cmd.called = False run_cmd_swap = self.swap_with_checks( common, 'run_cmd', mock_run_cmd, expected_args=[(expected_commands,)]) print_swap = self.print_swap(expected_args=[(stdout,)]) with print_swap, run_cmd_swap: run_e2e_tests.run_webdriver_manager(['start', '--detach'])