Skip to content
Snippets Groups Projects
Unverified Commit 85374465 authored by Manjinder Singh's avatar Manjinder Singh Committed by GitHub
Browse files

Changing test to work with django 2.1 and higher (#23573)

This is part of the django 2 upgrade
parent 26f0176d
No related merge requests found
#pylint: disable=missing-docstring
import django
import ddt
from django.test import TestCase
......@@ -34,9 +34,13 @@ class ViewersWidgetTest(TestCase):
"""
dummy_string_value = 'staff, verified'
input_field_name = 'viewers'
expected_widget_html = u'<input type="text" name="{input_field_name}" value="{serialized_value}" />'.format(
extra_formating = ''
if django.VERSION < (2, 1):
extra_formating = ' /'
expected_widget_html = '<input type="text" name="{input_field_name}" value="{serialized_value}"{extra_formating}>'.format(
input_field_name=input_field_name,
serialized_value=dummy_string_value,
extra_formating=extra_formating,
)
output = self.widget.render(name=input_field_name, value=dummy_string_value)
self.assertEqual(expected_widget_html, output)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment