Example #1
0
def test_xml_parsed():
    content = '''<?xml version="1.0" encoding="UTF-8"?>
    <response>
    <id>32e9a4a2</id>
    <test-mode>1</test-mode>
    <type>accept</type>
    </response>
    '''
    parser = XMLParser({
        'success': {
            'base': '//test-mode/text()'
        }
    })
    assert parser.parse(content).success == ['1']
    assert parser.parse(content).parse('string(//id/text())') == '32e9a4a2'
Example #2
0
def test_xml_parsed(settings):
    parsed = XMLParser(settings).parse(XML_CONTENT)
    assert parsed.success == ['1']
    assert parsed.parse('string(//id/text())') == '32e9a4a2'