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! |
+
+
+
+
+
+
+
+
+
+
+
+ 3
+ 1
+ 2
+
+
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+ False
+ False
+
+
+
diff --git a/tests/test-data/msodde/dde-in-word2003.xml b/tests/test-data/msodde/dde-in-word2003.xml
new file mode 100644
index 0000000..c323b30
--- /dev/null
+++ b/tests/test-data/msodde/dde-in-word2003.xml
@@ -0,0 +1,3 @@
+
+
+useruser202018-01-04T17:21:00Z2018-01-04T17:21:00Z11277118811.0000DDEAUTO c:\\windows\\system32\\cmd.exe "/k calc.exe"!Unerwartetes Ende des Ausdrucks
\ No newline at end of file
diff --git a/tests/test-data/msodde/dde-in-word2007.xml b/tests/test-data/msodde/dde-in-word2007.xml
new file mode 100644
index 0000000..496bb34
--- /dev/null
+++ b/tests/test-data/msodde/dde-in-word2007.xml
@@ -0,0 +1,3 @@
+
+
+The following field contains a dde link to calc.exeDDEAUTO c:\\windows\\system32\\cmd.exe "/k calc.exe"!Unerwartetes Ende des AusdrucksNormal0113129Microsoft Office Word011falseTitel1false141falsefalse12.0000useruser22018-01-10T09:21:00Z2018-01-10T09:21:00Z
\ No newline at end of file