diff --git a/tests/msodde/test_basic.py b/tests/msodde/test_basic.py index 29a444c..1966a2f 100644 --- a/tests/msodde/test_basic.py +++ b/tests/msodde/test_basic.py @@ -39,11 +39,11 @@ class TestReturnCode(unittest.TestCase): self.do_test_validity(join(BASE_DIR, 'msodde', filename + '.docm')) - def test_invalid_other(self): - """ check that xml do not work yet """ - for extn in '-2003.xml', '.xml': - self.do_test_validity(join(BASE_DIR, 'msodde', - 'harmless-clean' + extn), True) + def test_valid_xml(self): + """ check that xml leads to 0 exit status """ + for filename in 'harmless-clean-2003.xml', 'dde-in-excel2003.xml', \ + 'dde-in-word2003.xml', 'dde-in-word2007.xml': + self.do_test_validity(join(BASE_DIR, 'msodde', filename)) def test_invalid_none(self): """ check that no file argument leads to non-zero exit status """ @@ -133,6 +133,20 @@ class TestDdeLinks(unittest.TestCase): msg='unexpected output for dde-test.{0}: {1}' .format(extn, capturer.get_data())) + def test_xml(self): + """ check that dde in xml from word / excel is found """ + for name_part in 'excel2003', 'word2003', 'word2007': + filename = 'dde-in-' + name_part + '.xml' + with OutputCapture() as capturer: + msodde.main([join(BASE_DIR, 'msodde', filename), ]) + links = self.get_dde_from_output(capturer) + self.assertEqual(len(links), 1, 'found {0} dde-links in {1}' + .format(len(links), filename)) + self.assertTrue('cmd' in links[0], 'no "cmd" in dde-link for {0}' + .format(filename)) + self.assertTrue('calc' in links[0], 'no "calc" in dde-link for {0}' + .format(filename)) + def test_clean_rtf_blacklist(self): """ find a lot of hyperlinks in rtf spec """ filename = 'RTF-Spec-1.7.rtf' diff --git a/tests/test-data/msodde/dde-in-excel2003.xml b/tests/test-data/msodde/dde-in-excel2003.xml new file mode 100644 index 0000000..b24aef7 --- /dev/null +++ b/tests/test-data/msodde/dde-in-excel2003.xml @@ -0,0 +1,101 @@ + + + + + user + user + 2018-01-04T17:55:47Z + 11.9999 + + + + cmd|/c calc.exe + + A1 + + + + StdDocumentName + + + + + 12840 + 15315 + 360 + 105 + False + False + + + + + + + + This spread sheet has a dde link which starts calc.exe + + + #REF! + +
+ + +
+