Ticket #11911: 11911-and-12183-tests.patch

File 11911-and-12183-tests.patch, 1.8 KB (added by morty, 5 years ago)

Joint tests for tickets #11911 and #12183

  • tests/regressiontests/utils/tests.py

     
    55from unittest import TestCase
    66
    77from django.utils import html, checksums, text
    8 from django.utils.functional import SimpleLazyObject
     8from django.utils.functional import SimpleLazyObject, curry
    99
    1010import timesince
    1111import datastructures
     
    136136        for value, output in items:
    137137            self.check_output(f, value, output)
    138138
     139    def test_urlize(self):
     140        f = html.urlize
     141
     142        items = (
     143            ("djangoproject.com", "<a href=\"http://djangoproject.com\">djangoproject.com</a>"),
     144            ("django@example.com)", "<a href=\"mailto:django@example.com\">django@example.com</a>)"),
     145            ("(djangoproject.com)", "(<a href=\"http://djangoproject.com\">djangoproject.com</a>)"),
     146            ("djangoproject.com.", "<a href=\"http://djangoproject.com\">djangoproject.com</a>."),
     147            ("http://en.wikipedia.org/wiki/Django_(web_framework)",
     148             "<a href=\"http://en.wikipedia.org/wiki/Django_%28web_framework%29\">http://en.wikipedia.org/wiki/Django_(web_framework)</a>"),
     149        )
     150
     151        for value, output in items:
     152            self.check_output(f, value, output)
     153
     154        f = curry(html.urlize, nofollow=True)
     155
     156        items = (
     157            ("django@example.com djangoproject.com",
     158             "<a href=\"mailto:django@example.com\">django@example.com</a> <a href=\"http://djangoproject.com\" rel=\"nofollow\">djangoproject.com</a>"),
     159        )
     160
     161        for value, output in items:
     162            self.check_output(f, value, output)
     163
    139164class TestUtilsChecksums(TestCase):
    140165
    141166    def check_output(self, function, value, output=None):
Back to Top