def classic_in_out_func(username, password, hostname, applid, ssid, security=True): em = Emulator(hostname, model=2, oversize=(24, 80)) d = em.display try: welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: welcome.shift((1, 0))(f"L {applid} DATA='LROWS=9999,DB2={ssid}'", keys.ENTER, 240) if security: d(username, keys.NEWLINE) d(password, keys.ENTER) else: d(key=keys.ENTER, timeout=30) assert d.find('ZMENU VTM') yield d d(key=keys.PF3) d('X', key=keys.ENTER) finally: em.disconnect() em.close()
def classic_in_out(request): user = username if hasattr(request, 'param'): user = request.param em = Emulator(hostname, model=2, oversize=(24, 80)) try: d = em.display welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: logger.info(f"Logging to Classic applid {applid}") welcome.shift((1, 0))(f"L {applid} DATA='LROWS=9999'", keys.ENTER, 240) d(user, keys.NEWLINE) d(password, keys.ENTER) assert d.find('ZMENU VTM OM/DEX') yield d d(key=keys.PF3) d('X', key=keys.ENTER) finally: em.disconnect() em.close()
def classic_in_out(request): user = username if hasattr(request, 'param'): user = request.param em = Emulator(hostname, model=2, oversize=(24, 80)) d = em.display try: welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: logger.info(f"Logging to Classic applid {applid}") welcome.shift((1, 0))(f"L {applid}", keys.ENTER, 240) # welcome.shift((1, 0))(f"L {applid} DATA='cics={cics_job},LROWS=9999'", keys.ENTER, 30) #welcome(key=Keys.ENTER, wait_for="Please press ENTER to begin") d.find('ENTER USERID') d(user, keys.NEWLINE) d(password, keys.ENTER) assert d.find('ZMENU VTM OI-II') yield d d(key=keys.PF3) d('X', key=keys.ENTER) finally: em.disconnect() em.close()
def close_beacon(emulator: Emulator): logger.info("exiting applid") try: emulator.display(key=keys.HOME) emulator.display('=x', key=keys.ENTER, timeout=1000) finally: emulator.disconnect() emulator.close() logger.info("emulator was closed successfully")
def classic_in_out(request): user = username if hasattr(request, 'param'): user = request.param em = Emulator(hostname, model=2, oversize=(24, 80)) d = em.display try: welcome = d.find('===> Ex.: LOGON <userid>, TSO <userid>') if welcome: welcome.shift((1, 0))(f"L {applid} DATA='LROWS=9999,DB2={ssid}'", keys.ENTER, 240) d(user, keys.NEWLINE) d(password, keys.ENTER) yield d finally: em.disconnect() em.close()