From abf93bda96c8885fe0333f261f9fa3c342e53bd7 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Thu, 23 Nov 2017 09:51:26 +0100 Subject: [PATCH] unittest: add excel 2007+ test files to msodde-test --- tests/msodde/test_basic.py | 11 ++++++++++- tests/test-data/msodde/dde-test.xlsm | Bin 0 -> 9225 bytes tests/test-data/msodde/dde-test.xlsx | Bin 0 -> 9208 bytes 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 tests/test-data/msodde/dde-test.xlsm create mode 100644 tests/test-data/msodde/dde-test.xlsx diff --git a/tests/msodde/test_basic.py b/tests/msodde/test_basic.py index dfc44ca..164773d 100644 --- a/tests/msodde/test_basic.py +++ b/tests/msodde/test_basic.py @@ -76,7 +76,7 @@ class TestReturnCode(unittest.TestCase): return_code)) -class TestDdeInDoc(unittest.TestCase): +class TestDdeLinks(unittest.TestCase): def get_dde_from_output(self, capturer): """ helper to read dde links from captured output """ @@ -116,6 +116,15 @@ class TestDdeInDoc(unittest.TestCase): self.assertNotEqual(len(self.get_dde_from_output(capturer)), 0, msg='Found no dde links in output for doc file') + def test_excel(self): + """ check that dde links are found in excel 2007+ files """ + expect = ['DDE-Link cmd /c calc.exe', ] + for extn in 'xlsx', 'xlsm': # not yet: 'xlsb' + with OutputCapture() as capturer: + msodde.main([join(BASE_DIR, 'msodde', 'dde-test.' + extn), ]) + self.assertEqual(expect, self.get_dde_from_output(capturer)) + + if __name__ == '__main__': unittest.main() diff --git a/tests/test-data/msodde/dde-test.xlsm b/tests/test-data/msodde/dde-test.xlsm new file mode 100644 index 0000000..0740182 Binary files /dev/null and b/tests/test-data/msodde/dde-test.xlsm differ diff --git a/tests/test-data/msodde/dde-test.xlsx b/tests/test-data/msodde/dde-test.xlsx new file mode 100644 index 0000000..33c828d Binary files /dev/null and b/tests/test-data/msodde/dde-test.xlsx differ -- libgit2 0.21.4