def test_override_default_namespace():
    directory = os.path.dirname(__file__)
    json_idioms_dir = find_dir(directory, "idioms-json")
    json_path = os.path.join(json_idioms_dir, "cve-in-exploit-target.json")

    initialize_options()
    set_option_value("use_namespace", "somenamespace http://somenamespace.com")
    converted_xml = slide_file(json_path)

    assert "xmlns:somenamespace=\"http://somenamespace.com\"" in converted_xml
    assert "id=\"somenamespace:" in converted_xml
示例#2
0
def test_idiom_mapping(test_file, stored_master):
    """Test fresh conversion from XML to JSON matches stored JSON samples."""
    print("Checking - " + test_file)

    initialize_options()

    converted_new_xml = slide_file(test_file)
    converted_new_xml = StringIO(converted_new_xml)
    converted_new_xml = xml.to_etree(converted_new_xml)

    assert xml_compare(converted_new_xml.getroot(), stored_master.getroot(), reporter=print)
    marking_compare(converted_new_xml.getroot(), stored_master.getroot())