Beispiel #1
0
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"
Beispiel #2
0
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
Beispiel #3
0
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"
Beispiel #4
0
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"
Beispiel #5
0
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()
Beispiel #6
0
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)
Beispiel #7
0
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