def test_5250(): cmd = 'WRKACTJOB' key = 'lljqezl' element = ET.fromstring(iCmd5250(key, cmd).xml_in()) assert(element.tag == 'sh') assert('error' in element.attrib) assert(element.attrib['error'] == 'fast') assert('var' in element.attrib) assert(element.attrib['var'] == key) assert(element.text == to5250(cmd))
def test_5250_row_off(): cmd = 'WRKACTJOB' key = 'lkjwernm' row = 'off' element = ET.fromstring(iCmd5250(key, cmd, {'row': row}).xml_in()) assert(element.tag == 'sh') assert('row' in element.attrib) assert(element.attrib['row'] == row) assert('var' in element.attrib) assert(element.attrib['var'] == key) assert(element.text == to5250(cmd))
def test_5250_error_off(): cmd = 'WRKACTJOB' key = 'lkjwernm' error = 'off' element = ET.fromstring(iCmd5250(key, cmd, {'error': error}).xml_in()) assert(element.tag == 'sh') assert('error' in element.attrib) assert(element.attrib['error'] == error) assert('var' in element.attrib) assert(element.attrib['var'] == key) assert(element.text == to5250(cmd))
def test_5250_space(): cmd = 'WRKACTJOB SBS(*QINTER)' key = 'lknwqekrn' element = ET.fromstring(iCmd5250(key, cmd).xml_in()) assert (element.tag == 'sh') assert ('error' in element.attrib) assert (element.attrib['error'] == 'fast') assert ('var' in element.attrib) assert (element.attrib['var'] == key) assert ( element.text == "/QOpenSys/usr/bin/system 'WRKACTJOB SBS(*QINTER)'")
def test_5250_row_on(): cmd = 'WRKACTJOB' key = 'rtoiu1nqew' row = 'on' element = ET.fromstring(iCmd5250(key, cmd, {'row': row}).xml_in()) assert (element.tag == 'sh') assert ('row' in element.attrib) assert (element.attrib['row'] == row) assert ('var' in element.attrib) assert (element.attrib['var'] == key) assert (element.text == "/QOpenSys/usr/bin/system WRKACTJOB")
def test_5250_error_on(): cmd = 'WRKACTJOB' key = 'rtoiu1nqew' error = 'on' element = ET.fromstring(iCmd5250(key, cmd, {'error': error}).xml_in()) assert (element.tag == 'sh') assert ('error' in element.attrib) assert (element.attrib['error'] == error) assert ('var' in element.attrib) assert (element.attrib['var'] == key) assert (element.text == "/QOpenSys/usr/bin/system WRKACTJOB")
def test_5250_inner_string(): cmd = "wrklnk '/test/file'" key = 'znxvlkja' element = ET.fromstring(iCmd5250(key, cmd).xml_in()) assert (element.tag == 'sh') assert ('error' in element.attrib) assert (element.attrib['error'] == 'fast') assert ('var' in element.attrib) assert (element.attrib['var'] == key) assert (element.text == """/QOpenSys/usr/bin/system 'wrklnk '"'"'/test/file'"'"''""")
def itoolkit_run_command5250(self, command): '''IBM i XMLSERVICE call 5250 *CMD returning *OUTPUT''' itool = iToolKit() itransport = DatabaseTransport(self.conn) if command: command = command.upper().replace('OUTPUT(*)', '') itool.add(iCmd5250('command', command)) itool.call(itransport) command_output = itool.dict_out('command') ibmi_util.log_debug("command_output " + str(command_output), sys._getframe().f_code.co_name) out = '' err = '' if 'error' in command_output: rc = ibmi_util.IBMi_COMMAND_RC_ERROR err = str(command_output) else: rc = ibmi_util.IBMi_COMMAND_RC_SUCCESS out = str(command_output['command']) return rc, out, err