コード例 #1
0
def test_bind_sequenceable_properties(stc):
    plLogger = PLLogger.GetLogger("methodology")
    plLogger.LogInfo("start")
    ctor = CScriptableCreator()
    stc_sys = CStcSystem.Instance()
    assert stc_sys is not None
    sequencer = stc_sys.GetObject("Sequencer")

    # Call function with invalid command (nothing will happen)
    MethodologyGroupCommandUtils.bind_sequenceable_properties(None, True)

    # Create a command without sequenceable properties
    pkg = "spirent.methodology"
    cmd = ctor.Create(pkg + ".LoadTemplateCommand", sequencer)
    assert cmd is not None
    sp = cmd.GetObject("SequenceableCommandProperties", RelationType("SequenceableProperties"))
    assert sp is None

    # Call the bind_sequenceable_properties function
    # Make read only
    MethodologyGroupCommandUtils.bind_sequenceable_properties(cmd, False)
    sp = cmd.GetObject("SequenceableCommandProperties", RelationType("SequenceableProperties"))
    assert sp is not None
    check_sequenceable_properties(sp, False)

    # Make writeable
    MethodologyGroupCommandUtils.bind_sequenceable_properties(cmd, True)
    check_sequenceable_properties(sp, True)