def test_iperf_raise_error_on_iperf_problem(buffer_connection, command_output_and_expected_result_on_iperf_problem): iperf_cmd = Iperf2(connection=buffer_connection.moler_connection, options='-i') command_output, expected_result = command_output_and_expected_result_on_iperf_problem buffer_connection.remote_inject_response([command_output]) assert 'iperf -i' == iperf_cmd.command_string with pytest.raises(CommandFailure): iperf_cmd()
def test_iperf_raise_error_on_no_such_file(buffer_connection, command_output_and_expected_result_on_connect_failed): iperf_cmd = Iperf2(connection=buffer_connection.moler_connection, options='-c 10.156.236.132') command_output, expected_result = command_output_and_expected_result_on_connect_failed buffer_connection.remote_inject_response([command_output]) assert 'iperf -c 10.156.236.132' == iperf_cmd.command_string with pytest.raises(CommandFailure): iperf_cmd()
def test_iperf_raise_error_on_iperf_problem(buffer_connection): with pytest.raises(AttributeError) as err: Iperf2(connection=buffer_connection.moler_connection, options='-d -P 10') assert "Unsupported options combination (--dualtest & --parallel)" in str(err.value)
def test_iperf_can_set_direct_path_to_command_executable(buffer_connection): iperf_cmd = Iperf2(buffer_connection, options='-c 10.1.1.1 -M 1300 -m') assert "iperf -c 10.1.1.1 -M 1300 -m" == iperf_cmd.command_string iperf_cmd.command_path = 'adb shell /data/data/com.magicandroidapps.iperf/bin/' assert "adb shell /data/data/com.magicandroidapps.iperf/bin/iperf -c 10.1.1.1 -M 1300 -m" == iperf_cmd.command_string
def test_iperf_returns_proper_command_string(buffer_connection): iperf_cmd = Iperf2(buffer_connection, options='-c 10.1.1.1 -M 1300 -m') assert "iperf -c 10.1.1.1 -M 1300 -m" == iperf_cmd.command_string