def test_wait_until_string_string_not_found(mocker: MockerFixture, under_test: x3270): mocker.patch("Mainframe3270.py3270.Emulator.string_get", return_value="abc") with pytest.raises(Exception, match='String "def" not found in 1 seconds'): under_test.wait_until_string("def", 1)
def test_wait_until_string_not_found_until_timeout(mocker: MockerFixture, under_test: x3270): mocker.patch("Mainframe3270.py3270.Emulator.string_get", return_value="abc") mocker.patch("time.ctime", return_value="Sat Feb 12 15:29:51 2022") with pytest.raises(Exception, match='String "abc" not found in 5 seconds'): under_test.wait_until_string("abc")
def test_wait_until_string(mocker: MockerFixture, under_test: x3270): mocker.patch("Mainframe3270.py3270.Emulator.string_get", return_value="abc") txt = under_test.wait_until_string("abc") assert txt == "abc"