snap_test_link_handling.py 1.4 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_absolute_link_to_site_is_changed_to_relative_link 1"
  8. ] = '<p>clean_links step cleans <a href="/" target="_blank">example.com</a></p>'
  9. snapshots[
  10. "test_absolute_link_to_site_without_schema_is_changed_to_relative_link 1"
  11. ] = '<p>clean_links step cleans <a href="/" target="_blank">example.com</a></p>'
  12. snapshots[
  13. "test_absolute_link_with_path_to_site_is_changed_to_relative_link 1"
  14. ] = '<p>clean_links step cleans <a href="/somewhere-something/" target="_blank">example.com/somewhere-something/</a></p>'
  15. snapshots[
  16. "test_local_image_is_changed_to_relative_link 1"
  17. ] = '<p>clean_links step cleans <img alt="example.com/media/img.png" src="/media/img.png" /></p>'
  18. snapshots[
  19. "test_parser_converts_unmarked_links_to_hrefs 1"
  20. ] = '<p>Lorem ipsum <a href="http://test.com" rel="external nofollow noopener" target="_blank">test.com</a></p>'
  21. snapshots[
  22. "test_parser_skips_links_in_code_bbcode 1"
  23. ] = "<pre><code>http://test.com</code></pre>"
  24. snapshots[
  25. "test_parser_skips_links_in_inline_code_bbcode 1"
  26. ] = """<p>Lorem ipsum <br />
  27. </p><pre><code>http://test.com</code></pre><p></p>"""
  28. snapshots[
  29. "test_parser_skips_links_in_inline_code_markdown 1"
  30. ] = "<p>Lorem ipsum <code>http://test.com</code></p>"