Skip to content
9 changes: 7 additions & 2 deletions tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import unittest

import django
from django.template import Context, Template
from django.test import TestCase
from django.test import TestCase, override_settings
from django.utils.html import urlize

from rest_framework.compat import coreapi, coreschema
Expand Down Expand Up @@ -240,6 +241,7 @@ class Issue1386Tests(TestCase):
Covers #1386
"""

@override_settings(URLIZE_ASSUME_HTTPS=True)
def test_issue_1386(self):
"""
Test function urlize with different args
Expand All @@ -248,8 +250,9 @@ def test_issue_1386(self):
"asdf.com",
"asdf.net",
"www.as_df.org",
"as.d8f.ghj8.gov",
]
if django.VERSION < (5, 3):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should keep this check for a while

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we wait for 6.0b2 to be released? At that point we should no longer need it (there was a regression in Django, which has been fixed now)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can wait bor dj b2 or rc1. yes I saw the fix for the regression.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@browniebroke I ran the tests against main branch, But still showing Incorrect url. Idk why this is happening.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I checked it. It is passing for django main now. failing for django6.0b1. Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be backported to 6.0.x soon

correct_urls.append("as.d8f.ghj8.gov")
for i in correct_urls:
res = urlize(i)
self.assertNotEqual(res, i)
Expand All @@ -259,6 +262,8 @@ def test_issue_1386(self):
"mailto://asdf@fdf.com",
"asdf.netnet",
]
if django.VERSION >= (5, 3):
incorrect_urls.append("as.d8f.ghj8.gov")
for i in incorrect_urls:
res = urlize(i)
self.assertEqual(i, res)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ def test_single_field_uniq_validators(self):

validators = serializer.fields['fancy_conditions'].validators
assert len(validators) == 2 + extra_validators_qty
ids_in_qs = {frozenset(v.queryset.values_list(flat=True)) for v in validators if hasattr(v, "queryset")}
ids_in_qs = {frozenset(v.queryset.values_list('id', flat=True)) for v in validators if hasattr(v, "queryset")}
assert ids_in_qs == {frozenset([1]), frozenset([3])}

def test_nullable_unique_constraint_fields_are_not_required(self):
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
envlist =
{py310}-{django42,django51,django52}
{py311}-{django42,django51,django52}
{py312}-{django42,django51,django52,djangomain}
{py313}-{django51,django52,djangomain}
{py314}-{django52,djangomain}
{py312}-{django42,django51,django52,django60,djangomain}
{py313}-{django51,django52,django60,djangomain}
{py314}-{django52,django60,djangomain}
base
dist
docs
Expand All @@ -20,6 +20,7 @@ deps =
django50: Django>=5.0,<5.1
django51: Django>=5.1,<5.2
django52: Django>=5.2,<6.0
django60: Django>=6.0b1,<6.1
djangomain: https://github.com/django/django/archive/main.tar.gz
-rrequirements/requirements-testing.txt
-rrequirements/requirements-optionals.txt
Expand Down