snap_test_link_handling.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # -*- coding: utf-8 -*-
  2. # snapshottest: v1 - https://goo.gl/zC4yUc
  3. from __future__ import unicode_literals
  4. from snapshottest import Snapshot
  5. snapshots = Snapshot()
  6. snapshots[
  7. "test_parser_converts_unmarked_links_to_hrefs 1"
  8. ] = '<p>Lorem ipsum <a href="http://test.com" rel="nofollow noopener">test.com</a></p>'
  9. snapshots[
  10. "test_parser_skips_links_in_inline_code_markdown 1"
  11. ] = "<p>Lorem ipsum <code>http://test.com</code></p>"
  12. snapshots[
  13. "test_parser_skips_links_in_inline_code_bbcode 1"
  14. ] = """<p>Lorem ipsum <br/>
  15. </p><pre><code>http://test.com</code></pre><p></p>"""
  16. snapshots[
  17. "test_parser_skips_links_in_code_bbcode 1"
  18. ] = "<pre><code>http://test.com</code></pre>"
  19. snapshots[
  20. "test_absolute_link_to_site_is_changed_to_relative_link 1"
  21. ] = '<p>clean_links step cleans <a href="/">example.com</a></p>'
  22. snapshots[
  23. "test_absolute_link_to_site_without_schema_is_changed_to_relative_link 1"
  24. ] = '<p>clean_links step cleans <a href="/">example.com</a></p>'
  25. snapshots[
  26. "test_absolute_link_with_path_to_site_is_changed_to_relative_link 1"
  27. ] = '<p>clean_links step cleans <a href="/somewhere-something/">example.com/somewhere-something/</a></p>'
  28. snapshots[
  29. "test_local_image_is_changed_to_relative_link 1"
  30. ] = '<p>clean_links step cleans <img alt="example.com/media/img.png" src="/media/img.png"/></p>'