def test_situation_open(): z = JESAdapter(hostname, username, password) job = z.submit_jcl(path_relative=True, path='resources/jobs/wait.jcl', params={ '{seconds}': '90', '{job}': WAIT_JOB }, wait=False) em = u.logon_beacon(hostname, applid, username, password) try: d = em.display open_situation = False cur_try = 0 while not open_situation and cur_try < 10: time.sleep(10) if d.find('Open') is None: d.find('Navigate')('').enter() d('c').enter() d.find('Navigate')('').enter() d('e').enter() d.find('+ z/OS')('', key=keys.ENTER) if d.find(regex=f'\+(\s+)RSPLEXL4:{hostname.upper()}:MVSSYS'): d.find(regex=f'\+(\s+)RSPLEXL4:{hostname.upper()}:MVSSYS')( '', key=keys.ENTER) sit_already_there = d.find(regex=f'\+(\s+){SIT_NAME}') if sit_already_there: # "click" to open to see the state sit_already_there('', key=keys.ENTER) else: open_situation = True cur_try += 1 assert d.find('Open') finally: u.close_beacon(em)
def test_not_defined_user_can_only_logoff(): util.set_security(hostname, username, password, rtes[rte]['rte_hlq'], rte, 'notdefined_user', 'multi', ()) ds = z.read_ds(f'{hlq}.UKOBDATF({username[:-1].upper()}B)') z.del_ds(f'{hlq}.UKOBDATF({username[:-1].upper()}B)') time.sleep(30) em = e3270u.logon_beacon(hostname, applid, username=username[:-1] + 'b', password=password) try: d = em.display d(key=keys.HOME) for option in ['e', 'z', 'c', 'g', 'i', 'd', 'm', 'n', 's']: current_panel = e3270u.get_current_panel(d) d('n.' + option).enter() if option == 'e': d('n.h').enter() d('n.h').enter() assert d.find('Multi-Tenancy Definition Error') else: assert current_panel == e3270u.get_current_panel(d) finally: e3270u.close_beacon(em) zftp = ZFTP(hostname, username, password) zftp.upload_ds(text=ds, dest=f'{hlq}.UKOBDATF({username[:-1].upper()}B)')
def e3270_in_out(request): mod = request.module em = u.logon_beacon(mod.hostname, mod.applid, mod.username, mod.password) try: u.display = em.display yield em.display finally: u.close_beacon(em)
def e3270_special(): em = e3270u.logon_beacon(hostname, applid, username=username[:-1], password=password) try: display = em.display yield display finally: e3270u.close_beacon(em)
def test_non_super_user_has_not_access_to_all_db2_ssids_at_both_levels(): util.set_security(hostname, username, password, rtes[rte]['rte_hlq'], rte, 'nonsuperuser', 'multi', ()) em = e3270u.logon_beacon(hostname, applid, username=username[:-1], password=password) try: d = em.display() assert d.find('No Client Defined') d(key=keys.HOME) d('n.d').enter() assert 'Rows:00' finally: e3270u.close_beacon(em) util.set_security(hostname, username, password, rtes[rte]['rte_hlq'], rte, 'dataset', 'multi', ())
def test_tennant_users_with_no_access_to_zos_are_able_to_view_memory_display(): data = z.read_ds(f'{hlq}.UKOBDATF(KOBGROUP)') start = data.find('TDB2') if data.find('SHOWZOS=Y', start): data = data.replace('SHOWZOS=Y', 'SHOWZOS=N') z.write_ds(f'{hlq}.UKOBDATF(KOBGROUP)', data) em = e3270u.logon_beacon(hostname, applid, username, password) try: d = em.display d(key=keys.HOME) d('n.z').enter() assert e3270u.get_current_panel(d) == 'KOBSEVTS' d(key=keys.HOME) d('v.m').enter() assert e3270u.get_current_panel(d) == 'KOBSEVTS' finally: e3270u.close_beacon(em)
def test_verify_corp2(): em = e3270u.logon_beacon(hostname, applid, username=username[:-1] + 'b', password=password) try: d = em.display if d.find('Security system denied request'): d(key=keys.PF3) d(key=keys.HOME) d('n.d').enter() db2s = e3270u.get_column_list('DB2\nID', 4, d=d) if db2s: assert all(db2[1] == 'C' for db2 in db2s), 'multi-user sees additional data' else: assert False, 'multi-user does not have data' finally: e3270u.close_beacon(em)
def test_no_whats_new_for_new_user(): util.set_security(hostname, username, password, rtes[rte]['rte_hlq'], rte, 'notdefined_user', 'multi', ()) ds = z.read_ds(f'{hlq}.UKOBDATF({username[:-1].upper()}B)') z.del_ds(f'{hlq}.UKOBDATF({username[:-1].upper()}B)') time.sleep(30) em = e3270u.logon_beacon(hostname, applid, username=username[:-1] + 'b', password=password) try: d = em.display assert e3270u.get_current_panel(d) != "KOBSSNEW" d(key=keys.HOME) d('h.w').enter() assert e3270u.get_current_panel(d) == "KOBHLDIR" finally: e3270u.close_beacon(em) zftp = ZFTP(hostname, username, password) zftp.upload_ds(text=ds, dest=f'{hlq}.UKOBDATF({username[:-1].upper()}B)')
def test_check_do_not_show_the_first_sub_panel_and_jvm_tree(): text_from_kobuser = z.read_ds(f'{hlq}.UKOBDATF(KOBUSER)') group_user = re.search(f'USERID:{username.upper()}\s+GROUP:(\w+)', text_from_kobuser).group(1) text_from_kobgroup = z.read_ds(f'{hlq}.UKOBDATF(KOBGROUP)') group_pos = re.search(group_user, text_from_kobgroup).end() if text_from_kobgroup.find('SHOWJAVA=Y', group_pos): text_changed = text_from_kobgroup.replace('SHOWJAVA=Y', 'SHOWJAVA=N') z.write_ds(f'{hlq}.UKOBDATF(KOBGROUP)', text_changed) em = e3270u.logon_beacon(hostname, applid, username, password) try: d = em.display d(key=keys.HOME) d('=KOBSEVTS').enter() assert e3270u.get_current_panel(d) == 'KOBSEVTS' assert not d.find(regex=r'Tree\sname\s\S+\s+Options') current_panel = e3270u.get_current_panel(d) d('n.j').enter() assert current_panel == e3270u.get_current_panel(d) finally: z.write_ds(f'{hlq}.UKOBDATF(KOBGROUP)', text_from_kobgroup) e3270u.close_beacon(em)
def test_kobgroup_firstws_working_for_superuser(zosmf): """ https://jira.rocketsoftware.com/browse/OMBS-1407 Setting up user TS5813A as SUPER and changing group to OMEGCICS in KOBUSER member. Checking if FIRSTWS KOBSCICS specified in KOBGROUP for OMEGCICS will be picked up by superuser logon. Reverting changes made in KOBUSER member. """ rte_hlq = rtes[rte]['rte_hlq'] input_file = f"{rte_hlq}.UKOBDATF(KOBUSER)" file_backup = zosmf.read_ds(input_file) try: required_setup = f'{username.upper()} GROUP:OMEGCICS SUPER:YES' text_to_change = re.sub( rf"{username.upper()}\s+GROUP:(\w+)\s+SUPER:\w+", required_setup, file_backup) zosmf.write_ds(input_file, text_to_change) em = e3270u.logon_beacon(hostname, applid, username, password) d = em.display d(key=keys.HOME) assert e3270u.get_current_panel(d) == 'KOBSCICS' finally: e3270u.close_beacon(em) zosmf.write_ds(input_file, file_backup)