1414from selenium .webdriver .support .wait import WebDriverWait
1515
1616from django_select2 .cache import cache
17+ from django_select2 .conf import settings
1718from django_select2 .forms import (
1819 HeavySelect2MultipleWidget , HeavySelect2Widget , ModelSelect2TagWidget ,
1920 ModelSelect2Widget , Select2Widget
@@ -104,44 +105,44 @@ def test_empty_option(self, db):
104105 def test_i18n (self ):
105106 translation .activate ('de' )
106107 assert tuple (Select2Widget ().media ._js ) == (
107- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' ,
108- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/i18n/de.js' ,
108+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' ,
109+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/i18n/de.js' ,
109110 'django_select2/django_select2.js'
110111 )
111112
112113 translation .activate ('en' )
113114 assert tuple (Select2Widget ().media ._js ) == (
114- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' ,
115- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/i18n/en.js' ,
115+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' ,
116+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/i18n/en.js' ,
116117 'django_select2/django_select2.js'
117118 )
118119
119120 translation .activate ('00' )
120121 assert tuple (Select2Widget ().media ._js ) == (
121- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' ,
122+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' ,
122123 'django_select2/django_select2.js'
123124 )
124125
125126 translation .activate ('sr-cyrl' )
126127 assert tuple (Select2Widget ().media ._js ) == (
127- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' ,
128- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/i18n/sr-Cyrl.js' ,
128+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' ,
129+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/i18n/sr-Cyrl.js' ,
129130 'django_select2/django_select2.js'
130131 )
131132
132133 pytest .importorskip ("django" , minversion = "2.0.4" )
133134
134135 translation .activate ('zh-hans' )
135136 assert tuple (Select2Widget ().media ._js ) == (
136- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' ,
137- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/i18n/zh-CN.js' ,
137+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' ,
138+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/i18n/zh-CN.js' ,
138139 'django_select2/django_select2.js'
139140 )
140141
141142 translation .activate ('zh-hant' )
142143 assert tuple (Select2Widget ().media ._js ) == (
143- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' ,
144- '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/i18n/zh-TW.js' ,
144+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' ,
145+ f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/i18n/zh-TW.js' ,
145146 'django_select2/django_select2.js'
146147 )
147148
@@ -150,8 +151,8 @@ class TestSelect2MixinSettings(object):
150151 def test_default_media (self ):
151152 sut = Select2Widget ()
152153 result = sut .media .render ()
153- assert '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /js/select2.min.js' in result
154- assert '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.3 /css/select2.min.css' in result
154+ assert f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /js/select2.min.js' in result
155+ assert f '//cdnjs.cloudflare.com/ajax/libs/select2/{ settings . SELECT2_LIB_VERSION } /css/select2.min.css' in result
155156 assert 'django_select2/django_select2.js' in result
156157
157158 def test_js_setting (self , settings ):
0 commit comments