Ejemplo n.º 1
0
def test_command_SLEEP():
    #command.context = {}

    s = command.factory("SLEEP")
    s.vm = "vm"

    s.execute("vm", "protocol", {"ciao":"mondo"})
    logging.debug(command.context)

    assert "ciao" in command.context
    assert command.context["ciao"] == "mondo"

    s = command.factory("SET")
    s.vm = "vm"
    s.execute( s.vm, {"pippo":"franco", "hello":"world", "number":"123"})
    assert "ciao" in command.context
    assert command.context["ciao"] == "mondo"

    logging.debug(command.context)
Ejemplo n.º 2
0
def test_command_SLEEP():
    #command.context = {}

    s = command.factory("SLEEP")
    s.vm = "vm"

    s.execute("vm", "protocol", {"ciao": "mondo"})
    logging.debug(command.context)

    assert "ciao" in command.context
    assert command.context["ciao"] == "mondo"

    s = command.factory("SET")
    s.vm = "vm"
    s.execute(s.vm, {"pippo": "franco", "hello": "world", "number": "123"})
    assert "ciao" in command.context
    assert command.context["ciao"] == "mondo"

    logging.debug(command.context)
Ejemplo n.º 3
0
def test_dispatcher():
    c = command.factory(["BEGIN", True, ['whatever', 'end']])
    agentFiles = ""
    params = ""

    update = Procedure("UPDATE", ["REVERT", "START_VM", "RELOG", "STOP_VM"])
    dispatch = Procedure("DISPATCH", ["REVERT", "START_VM", ("PUSH", None, agentFiles)])
    scout = Procedure("SCOUT", [
        ("CALL", None, "dispatch"),
        ("PUSH", None, agentFiles),
    ])

    assert update
    assert dispatch
    assert scout
Ejemplo n.º 4
0
def test_procedure_insert():
    c = command.factory(["BEGIN", True, ['whatever', 'end']])
    agentFiles = ""
    params = ""

    p1 = Procedure("UPDATE", ["REVERT", "START_VM", "RELOG", "STOP_VM"])
    p2 = Procedure("DISPATCH", ["REVERT", "START_VM", ("PUSH", None, agentFiles)])

    lp1= len(p1)
    lp2= len(p2)

    p1.insert(p2)

    assert p1
    assert p2
    assert len(p1) == lp1 + lp2