Пример #1
0
def test_generic_deserialize(name):
    filename = path.join(BASE_DIR, '%s-simple.xml' % name)
    parser = etree.XMLParser(
        ns_clean=True, remove_blank_text=True, remove_comments=True)
    target = etree.parse(filename, parser).getroot()

    build_fn_name = ('build-%s-simple' % name).replace('-', '_')
    expected = globals()[build_fn_name]().serialize()

    result = schema.deserialize(target).serialize()

    assert_node(expected, result)
Пример #2
0
def test_generic_deserialize(name):
    filename = path.join(BASE_DIR, '%s-simple.xml' % name)
    parser = etree.XMLParser(ns_clean=True,
                             remove_blank_text=True,
                             remove_comments=True)
    target = etree.parse(filename, parser).getroot()

    build_fn_name = ('build-%s-simple' % name).replace('-', '_')
    expected = globals()[build_fn_name]().serialize()

    result = schema.deserialize(target).serialize()

    assert_node(expected, result)
Пример #3
0
def test_generic_deserialize_outside_registry():
    xml = build_authentication_request_simple().serialize()
    xml.tag = 'BadTagName'
    result = schema.deserialize(xml)

    assert result is None
Пример #4
0
def test_generic_deserialize_outside_registry():
    xml = build_authentication_request_simple().serialize()
    xml.tag = 'BadTagName'
    result = schema.deserialize(xml)

    assert result is None