<filename>tests/test_unit_pgm.py
import xml.etree.ElementTree as ET

from itoolkit import iPgm

def test_pgm():
    pgm = 'MYPGM'
    key = 'lljqezl'
    
    element = ET.fromstring( iPgm(key, pgm).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('error' in element.attrib)
    assert(element.attrib['error'] == 'fast')
    

def test_pgm_error_on():
    pgm = 'MYPGM'
    key = '<KEY>'
    error = 'on'
    
    element = ET.fromstring(iPgm(key, pgm, {'error': error}).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('lib' not in element.attrib)
    assert('func' not in element.attrib)
    
    assert('error' in element.attrib)
    assert(element.attrib['error'] == error)
    
def test_pgm_error_off():
    pgm = 'MYPGM'
    key = '<KEY>'
    error = 'off'
    
    element = ET.fromstring(iPgm(key, pgm, {'error': error}).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('lib' not in element.attrib)
    assert('func' not in element.attrib)
    
    assert('error' in element.attrib)
    assert(element.attrib['error'] == error)

def test_pgm_lib():
    pgm = 'MYPGM'
    key = '<KEY>'
    lib = 'MYLIB'
    
    element = ET.fromstring(iPgm(key, pgm, {'lib': lib}).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('lib' in element.attrib)
    assert(element.attrib['lib'] == lib)
    
    assert('func' not in element.attrib)
    

<filename>tests/test_unit_pgm.py
import xml.etree.ElementTree as ET

from itoolkit import iPgm

def test_pgm():
    pgm = 'MYPGM'
    key = 'lljqezl'
    
    element = ET.fromstring( iPgm(key, pgm).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('error' in element.attrib)
    assert(element.attrib['error'] == 'fast')
    

def test_pgm_error_on():
    pgm = 'MYPGM'
    key = '<KEY>'
    error = 'on'
    
    element = ET.fromstring(iPgm(key, pgm, {'error': error}).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('lib' not in element.attrib)
    assert('func' not in element.attrib)
    
    assert('error' in element.attrib)
    assert(element.attrib['error'] == error)
    
def test_pgm_error_off():
    pgm = 'MYPGM'
    key = '<KEY>'
    error = 'off'
    
    element = ET.fromstring(iPgm(key, pgm, {'error': error}).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('lib' not in element.attrib)
    assert('func' not in element.attrib)
    
    assert('error' in element.attrib)
    assert(element.attrib['error'] == error)

def test_pgm_lib():
    pgm = 'MYPGM'
    key = '<KEY>'
    lib = 'MYLIB'
    
    element = ET.fromstring(iPgm(key, pgm, {'lib': lib}).xml_in())
    assert(element.tag == 'pgm')
    
    assert('var' in element.attrib)
    assert(element.attrib['var'] == key)
    
    assert('name' in element.attrib)
    assert(element.attrib['name'] == pgm)
    
    assert('lib' in element.attrib)
    assert(element.attrib['lib'] == lib)
    
    assert('func' not in element.attrib)
    
