Source

psilib / test_som.py

Full commit
'''Library for PSI maps'''

__title__ = 'test_som'
__version__ = '0.03-test'
__author__  = 'L. C. Rees (xanimal@users.sf.net)'

'''Tests SOM functionality in a structured way'''

from som import *

def testSom():
    '''Test if all of SOM is functioning properly'''
    test = Collection('test', 'test', 'test')
    test.addFilter('test', 'test', 'test')
    test.filters[0].addAction('read', 'test', 'test')
    test.filters[0].addAccess('grant', 'test', 'test')
    test.filters[0].addSort('par', 'test')
    test.filters[0].acl[0].addRight('read')
    test.filters[0].actions[0].addIf('test', 'test')
    test.filters[0].actions[0].setTime('day','5', '10', '11', '5')
    test.filters[0].addVersion('archive', 'seq')
    test.filters[0].setTime('week')
    test.filters[0].versions[0].addChange('name', 'test')
    test.addCollection('test2', 'thing', 'stuff')
    test.addField('thing')
    test.addResource('thing', 'thing', 'thing')
    test.addFilter('thing', 'thing')
    test.addCollection('thing3')
    test.addLink('test')
    test.addInclude('thing')
    test.addResource('test')
    test.resources[0].addResult('test')
    test.resources[0].setMetadata('planned')
    test.resources[0].metadata.addLog('read', 'planned', '10', '20', 'dude', 'test')
    test.resources[0].addFragment('test')
    test.resources[0].addText('some', 'some', 'some', 'preserve', 'some')
    test.resources[0].addException('test')
    test.resources[0].addParameter('test')
    test.resources[0].addResult('test2')
    test.resources[0].addFilter('test')
    test.resources[0].filters[0].addAccess('grant', 'ssl', 'dude')
    test.resources[0].filters[0].acl[0].addRight('read')
    test.resources[0].addLink('something')
    test.resources[0].addParameter('test2')
    test.resources[0].addField('test')
    test.resources[0].addFragment('test2')
    test.resources[0].addField('something')
    test.resources[0].addException('thing', 'thing', 'thing')
    test.resources[0].addInclude('test')
    test.resources[0].addResult('test3')
    test.setMetadata()
    test.addCollection('test3')
    document = Root()
    psi = Psi()
    psi.appendChild(test)
    document.appendChild(psi)
    print document       

if __name__ == '__main__': testSom()