Skip to content

Commit

Permalink
tests: add macro checks for additional download entries
Browse files Browse the repository at this point in the history
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 <git@jdknight.me>
  • Loading branch information
jdknight committed Nov 9, 2024
1 parent de10ee0 commit abb7ff9
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions tests/unit-tests/test_sphinx_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,25 @@ def test_storage_sphinx_download_defaults(self):
out_dir = self.build(self.dataset)

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

view_file_name = view_file_macro.find('ac:parameter',
{'ac:name': 'name'})
self.assertIsNotNone(view_file_name)
for view_file_macro in view_file_macros:
view_file_name = view_file_macro.find('ac:parameter',
{'ac:name': 'name'})
self.assertIsNotNone(view_file_name)

attachment_ref = view_file_name.find('ri:attachment')
self.assertIsNotNone(attachment_ref)
self.assertTrue(attachment_ref.has_attr('ri:filename'))
self.assertEqual(attachment_ref['ri:filename'], 'example.pdf')
attachment_ref = view_file_name.find('ri:attachment')
self.assertIsNotNone(attachment_ref)
self.assertTrue(attachment_ref.has_attr('ri:filename'))
self.assertEqual(attachment_ref['ri:filename'], 'example.pdf')

# link to file
file_link = data.find('ac:link')
Expand Down

0 comments on commit abb7ff9

Please sign in to comment.