Exemplo n.º 1
0
def test_copy_nvpairs():
    from crmsh.cibconfig import copy_nvpairs

    to = etree.fromstring('''
    <node>
    <nvpair name="stonith-enabled" value="true"/>
    </node>
    ''')
    copy_nvpairs(to, etree.fromstring('''
    <node>
    <nvpair name="stonith-enabled" value="false"/>
    </node>
    '''))

    eq_(['stonith-enabled'], to.xpath('./nvpair/@name'))
    eq_(['false'], to.xpath('./nvpair/@value'))

    copy_nvpairs(to, etree.fromstring('''
    <node>
    <nvpair name="stonith-enabled" value="true"/>
    </node>
    '''))

    eq_(['stonith-enabled'], to.xpath('./nvpair/@name'))
    eq_(['true'], to.xpath('./nvpair/@value'))
Exemplo n.º 2
0
def test_copy_nvpairs():
    from crmsh.cibconfig import copy_nvpairs

    to = etree.fromstring('''
    <node>
    <nvpair name="stonith-enabled" value="true"/>
    </node>
    ''')
    copy_nvpairs(
        to,
        etree.fromstring('''
    <node>
    <nvpair name="stonith-enabled" value="false"/>
    </node>
    '''))

    assert ['stonith-enabled'] == to.xpath('./nvpair/@name')
    assert ['false'] == to.xpath('./nvpair/@value')

    copy_nvpairs(
        to,
        etree.fromstring('''
    <node>
    <nvpair name="stonith-enabled" value="true"/>
    </node>
    '''))

    assert ['stonith-enabled'] == to.xpath('./nvpair/@name')
    assert ['true'] == to.xpath('./nvpair/@value')