Skip to content

Commit abb7ff9

Browse files
committed
tests: add macro checks for additional download entries
A series of download entries have been added to help verify project-relative paths are resolved. Extended the Confluence-related checks to verify that expected view-file macros are generated. Signed-off-by: James Knight <[email protected]>
1 parent de10ee0 commit abb7ff9

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/unit-tests/test_sphinx_download.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,25 @@ def test_storage_sphinx_download_defaults(self):
1919
out_dir = self.build(self.dataset)
2020

2121
with parse('index', out_dir) as data:
22-
# view-file
23-
view_file_macro = data.find('ac:structured-macro',
22+
# view-file(s)
23+
#
24+
# We have a couple of asset downloads in this example. A mixture
25+
# of paths to sanity check download paths function. All use the
26+
# same/replicated asset type and each will result in a single file
27+
# upload, so we should have three matching view-file macros.
28+
view_file_macros = data.find_all('ac:structured-macro',
2429
{'ac:name': 'view-file'})
25-
self.assertIsNotNone(view_file_macro)
30+
self.assertEqual(len(view_file_macros), 3)
2631

27-
view_file_name = view_file_macro.find('ac:parameter',
28-
{'ac:name': 'name'})
29-
self.assertIsNotNone(view_file_name)
32+
for view_file_macro in view_file_macros:
33+
view_file_name = view_file_macro.find('ac:parameter',
34+
{'ac:name': 'name'})
35+
self.assertIsNotNone(view_file_name)
3036

31-
attachment_ref = view_file_name.find('ri:attachment')
32-
self.assertIsNotNone(attachment_ref)
33-
self.assertTrue(attachment_ref.has_attr('ri:filename'))
34-
self.assertEqual(attachment_ref['ri:filename'], 'example.pdf')
37+
attachment_ref = view_file_name.find('ri:attachment')
38+
self.assertIsNotNone(attachment_ref)
39+
self.assertTrue(attachment_ref.has_attr('ri:filename'))
40+
self.assertEqual(attachment_ref['ri:filename'], 'example.pdf')
3541

3642
# link to file
3743
file_link = data.find('ac:link')

0 commit comments

Comments
 (0)