예제 #1
0
def test_sh():
    cmd = 'ls -l'
    key = 'lljqezl'

    element = ET.fromstring(iSh(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 == cmd)
예제 #2
0
def test_sh_row_off():
    cmd = 'ls -l'
    key = 'lkjwernm'
    row = 'off'

    element = ET.fromstring(iSh(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 == cmd)
예제 #3
0
def test_sh_error_off():
    cmd = 'ls -l'
    key = 'lkjwernm'
    error = 'off'

    element = ET.fromstring(iSh(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 == cmd)