def test_validate_during_run(stc):
    project = CStcSystem.Instance().GetObject("Project")
    ctor = CScriptableCreator()
    trf_mix = ctor.Create("StmTrafficMix", project)
    trf_mix.Set("MixInfo", '<MixInfo Load="10.0" LoadUnit="PERCENT_LINE_RATE" WeightList="30 70.0" />')
    cmd = ctor.CreateCommand("spirent.methodology.IteratorConfigTrafficLoadCommand")
    command.get_this_cmd = MagicMock(return_value=cmd)

    res = command.run([trf_mix.GetObjectHandle()], [], True, "fixed(1000)", 1, "FRAMES_PER_SECOND")
    assert res is True

    res = command.run([trf_mix.GetObjectHandle()], [], True, "rand(10, 100)", 1, "FRAMES_PER_SECOND")
    assert res is False

    res = command.run([trf_mix.GetObjectHandle()], [], True, "fixed(1000.5)", 1, "FRAMES_PER_SECOND")
    assert res is False

    res = command.run([trf_mix.GetObjectHandle()], [], True, "fixed(10.5)", 1, "PERCENT_LINE_RATE")
    assert res is True
def test_reset(stc):
    val = command.reset()
    assert val is True
def test_validate(stc):
    project = CStcSystem.Instance().GetObject("Project")
    ctor = CScriptableCreator()
    trf_mix = ctor.Create("StmTrafficMix", project)
    val = command.validate([trf_mix.GetObjectHandle()], [], True, "fixed(1000)", 1, "FRAMES_PER_SECOND")
    assert val == ""