def test_open_connection_with_port(mocker: MockerFixture): mocker.patch("Mainframe3270.py3270.Emulator.connect") under_test = x3270(**X3270_DEFAULT_ARGS) under_test.open_connection("myhost", port=2222) assert under_test.host == "myhost" assert under_test.port == 2222 assert under_test.credential == "myhost:2222"
def test_default_args(): under_test = x3270(True, 30, 0.5, 0.0, ".") assert under_test.visible is True assert under_test.timeout == 30 assert under_test.wait == 0.5 assert under_test.wait_write == 0.0 assert under_test.imgfolder == "." under_test.mf is None
def test_open_connection_with_lu(mocker): mocker.patch("Mainframe3270.py3270.Emulator.connect") under_test = x3270(**X3270_DEFAULT_ARGS) under_test.open_connection("myhost", "lu") assert under_test.host == "myhost" assert under_test.port == 23 assert under_test.lu == "lu" assert under_test.credential == "lu@myhost:23"
def test_output_folder_robotframework_running(mocker: MockerFixture): m_get_variable_value = mocker.patch( "robot.libraries.BuiltIn.BuiltIn.get_variable_value", return_value="/home/output", ) under_test = x3270(**X3270_DEFAULT_ARGS) m_get_variable_value.assert_called_with("${OUTPUT DIR}") assert under_test.output_folder == "/home/output"
def test_open_connection_existing_emulator(mocker): mocker.patch("Mainframe3270.py3270.Emulator.create_app") mocker.patch("Mainframe3270.py3270.Emulator.connect") mocker.patch("Mainframe3270.x3270.close_connection") under_test = x3270(**X3270_DEFAULT_ARGS) under_test.mf = Emulator() under_test.open_connection("myhost") Mainframe3270.x3270.close_connection.assert_called()
def test_open_connection(mocker: MockerFixture): m_connect = mocker.patch("Mainframe3270.py3270.Emulator.connect") under_test = x3270(**X3270_DEFAULT_ARGS) under_test.open_connection("myhost") assert under_test.host == "myhost" assert under_test.port == 23 assert under_test.lu is None assert under_test.credential == "myhost:23" m_connect.assert_called_with(under_test.credential)
def under_test(mocker: MockerFixture): mocker.patch("Mainframe3270.py3270.Emulator.create_app") under_test = x3270(**X3270_DEFAULT_ARGS) under_test.mf = Emulator(under_test.visible, under_test.timeout) return under_test