예제 #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
파일: test_webjs.py 프로젝트: paskma/py
def test_process_two():
    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": "True",
        "fullitemname": "modules/foo.py/test_item",
        "hostkey": None,
    }
    webjs.process(msg)
    trs = main_t.getElementsByTagName("tr")
    tds = trs[0].getElementsByTagName("td")
    # two cells in the row, one in the table inside one of the cells
    assert len(tds) == 3
    html = tds[0].innerHTML
    assert html == "foo.py[1/10]"
    assert tds[2].innerHTML == "."
예제 #3
0
파일: test_webjs.py 프로젝트: paskma/py
def test_process():
    main_t = dom.window.document.getElementById("main_table")
    assert len(main_t.getElementsByTagName("tr")) == 0
    assert not webjs.process({})

    msg = {
        "type": "ItemStart",
        "itemtype": "Module",
        "itemname": "foo.py",
        "fullitemname": "modules/foo.py",
        "length": 10,
    }
    assert webjs.process(msg)
    trs = main_t.getElementsByTagName("tr")
    assert len(trs) == 1
    tr = trs[0]
    assert len(tr.childNodes) == 2
    assert tr.childNodes[0].nodeName == "TD"
    assert tr.childNodes[0].innerHTML == "foo.py[0/10]"
    assert tr.childNodes[1].nodeName == "TD"
    assert tr.childNodes[1].childNodes[0].nodeName == "TABLE"
    assert len(tr.childNodes[1].getElementsByTagName("tr")) == 0