예제 #1
0
파일: test_webjs.py 프로젝트: paskma/py
def test_signal():
    main_t = dom.window.document.getElementById("main_table")
    msg = {
        "type": "ItemStart",
        "itemtype": "Module",
        "itemname": "foo.py",
        "fullitemname": "modules/foo.py",
        "length": 10,
    }
    webjs.process(msg)
    msg = {
        "type": "ReceivedItemOutcome",
        "fullmodulename": "modules/foo.py",
        "passed": "False",
        "fullitemname": "modules/foo.py/test_item",
        "hostkey": None,
        "signal": "10",
        "skipped": "False",
    }
    exported_methods.fail_reasons["modules/foo.py/test_item"] = "Received signal 10"
    exported_methods.stdout["modules/foo.py/test_item"] = ""
    exported_methods.stderr["modules/foo.py/test_item"] = ""
    webjs.process(msg)
    schedule_callbacks(exported_methods)
    # ouch
    assert (
        dom.document.getElementById("modules/foo.py").childNodes[0].childNodes[0].childNodes[0].childNodes[0].nodeValue
        == "F"
    )
예제 #2
0
def test_signal():
    main_t = dom.window.document.getElementById('main_table')
    msg = {'type': 'ItemStart',
           'itemtype': 'Module',
           'itemname': 'foo.py',
           'fullitemname': 'modules/foo.py',
           'length': 10,
           }
    webjs.process(msg)
    msg = {'type': 'ItemFinish',
           'fullmodulename': 'modules/foo.py',
           'passed' : 'False',
           'fullitemname' : 'modules/foo.py/test_item',
           'hostkey': None,
           'signal': '10',
           'skipped': 'False',
           }
    exported_methods.fail_reasons['modules/foo.py/test_item'] = 'Received signal 10'
    exported_methods.stdout['modules/foo.py/test_item'] = ''
    exported_methods.stderr['modules/foo.py/test_item'] = ''
    webjs.process(msg)
    schedule_callbacks(exported_methods)
    # ouch
    assert dom.document.getElementById('modules/foo.py').childNodes[0].\
        childNodes[0].childNodes[0].childNodes[0].nodeValue == 'F'
예제 #3
0
def test_method_call():
    class Meth(BasicExternal):
        @described(retval=int)
        def meth(self):
            return 8
            
    l = []
    
    def callback(i):
        l.append(i)
    
    meth = Meth()
    meth.meth(callback)
    schedule_callbacks(meth)
    assert l[0] == 8
예제 #4
0
def test_method_call():
    class Meth(BasicExternal):
        @described(retval=int)
        def meth(self):
            return 8

    l = []

    def callback(i):
        l.append(i)

    meth = Meth()
    meth.meth(callback)
    schedule_callbacks(meth)
    assert l[0] == 8