From 7c110bf6d33d454030eb0de1cf1f1d15d8e6b48b Mon Sep 17 00:00:00 2001 From: Christian Mehlmauer Date: Tue, 5 Mar 2013 21:52:41 +0100 Subject: [PATCH] added checks for well formed xml --- spec/xml_checks_spec.rb | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/spec/xml_checks_spec.rb b/spec/xml_checks_spec.rb index 348ceabf..fdd99374 100644 --- a/spec/xml_checks_spec.rb +++ b/spec/xml_checks_spec.rb @@ -19,8 +19,7 @@ require 'spec_helper' -describe 'XML checks' do - +describe 'XSD checks' do after :each do FileTest.exists?(@file).should be_true @@ -60,3 +59,35 @@ describe 'XML checks' do @xsd = LOCAL_FILES_XSD end end + +describe 'Well formed XML checks' do + after :each do + FileTest.exists?(@file).should be_true + + begin + Nokogiri::XML(File.open(@file)) { |config| config.options = Nokogiri::XML::ParseOptions::STRICT } + rescue Nokogiri::XML::SyntaxError => e + fail "#{@file}: #{e.message}" + end + end + + it 'check plugin_vulns.xml for syntax errors' do + @file = PLUGINS_VULNS_FILE + end + + it 'check theme_vulns.xml for syntax errors' do + @file = THEMES_VULNS_FILE + end + + it 'check wp_versions.xml for syntax errors' do + @file = WP_VERSIONS_FILE + end + + it 'check wp_vulns.xml for syntax errors' do + @file = WP_VULNS_FILE + end + + it 'check local_vulnerable_files.xml for syntax errors' do + @file = LOCAL_FILES_FILE + end +end