@@ -122,9 +122,9 @@ def setUpTestData(cls):
122122 DocumentRelease .objects .bulk_create (
123123 DocumentRelease (lang = lang , release = release )
124124 for lang , release in [
125- ("en" , None ),
126- ("en" , r1 ),
127- ("en" , r2 ),
125+ (settings . DEFAULT_LANGUAGE_CODE , None ),
126+ (settings . DEFAULT_LANGUAGE_CODE , r1 ),
127+ (settings . DEFAULT_LANGUAGE_CODE , r2 ),
128128 ("sv" , r1 ),
129129 ("ar" , r1 ),
130130 ]
@@ -133,23 +133,28 @@ def setUpTestData(cls):
133133 def test_by_version (self ):
134134 self .assertQuerySetEqual (
135135 DocumentRelease .objects .by_version ("1.0" ),
136- [("en" , "1.0" ), ("sv" , "1.0" ), ("ar" , "1.0" )],
136+ [(settings . DEFAULT_LANGUAGE_CODE , "1.0" ), ("sv" , "1.0" ), ("ar" , "1.0" )],
137137 transform = attrgetter ("lang" , "version" ),
138138 ordered = False ,
139139 )
140140
141141 def test_by_version_dev (self ):
142142 self .assertQuerySetEqual (
143143 DocumentRelease .objects .by_version ("dev" ),
144- [("en" , "dev" )],
144+ [(settings . DEFAULT_LANGUAGE_CODE , "dev" )],
145145 transform = attrgetter ("lang" , "version" ),
146146 ordered = False ,
147147 )
148148
149149 def test_by_versions (self ):
150150 self .assertQuerySetEqual (
151151 DocumentRelease .objects .by_versions ("1.0" , "dev" ),
152- [("en" , "dev" ), ("en" , "1.0" ), ("sv" , "1.0" ), ("ar" , "1.0" )],
152+ [
153+ (settings .DEFAULT_LANGUAGE_CODE , "dev" ),
154+ (settings .DEFAULT_LANGUAGE_CODE , "1.0" ),
155+ ("sv" , "1.0" ),
156+ ("ar" , "1.0" ),
157+ ],
153158 transform = attrgetter ("lang" , "version" ),
154159 ordered = False ,
155160 )
@@ -159,18 +164,20 @@ def test_by_versions_empty(self):
159164 DocumentRelease .objects .by_versions ()
160165
161166 def test_get_by_version_and_lang_exists (self ):
162- doc = DocumentRelease .objects .get_by_version_and_lang ("1.0" , "en" )
167+ doc = DocumentRelease .objects .get_by_version_and_lang (
168+ "1.0" , settings .DEFAULT_LANGUAGE_CODE
169+ )
163170 self .assertEqual (doc .release .version , "1.0" )
164- self .assertEqual (doc .lang , "en" )
171+ self .assertEqual (doc .lang , settings . DEFAULT_LANGUAGE_CODE )
165172
166173 def test_get_by_version_and_lang_missing (self ):
167174 with self .assertRaises (DocumentRelease .DoesNotExist ):
168175 DocumentRelease .objects .get_by_version_and_lang ("2.0" , "sv" )
169176
170177 def test_get_available_languages_by_version (self ):
171178 get = DocumentRelease .objects .get_available_languages_by_version
172- self .assertEqual (list (get ("1.0" )), ["ar" , "en" , "sv" ])
173- self .assertEqual (list (get ("2.0" )), ["en" ])
179+ self .assertEqual (list (get ("1.0" )), ["ar" , settings . DEFAULT_LANGUAGE_CODE , "sv" ])
180+ self .assertEqual (list (get ("2.0" )), [settings . DEFAULT_LANGUAGE_CODE ])
174181 self .assertEqual (list (get ("3.0" )), [])
175182
176183
@@ -444,7 +451,7 @@ def test_search_title(self):
444451 with self .assertNumQueries (1 ):
445452 self .assertQuerySetEqual (
446453 misspelled_query ,
447- [("Generic views" , "en" , "1.2.3" )],
454+ [("Generic views" , settings . DEFAULT_LANGUAGE_CODE , "1.2.3" )],
448455 transform = attrgetter (
449456 "headline" , "release.lang" , "release.release.version"
450457 ),
0 commit comments