|
2 | 2 | Tests for validate Internationalization and XBlock i18n service. |
3 | 3 | """ |
4 | 4 | import gettext |
5 | | -from unittest import mock, skip |
| 5 | +from unittest import mock |
6 | 6 |
|
7 | 7 | from django.utils import translation |
8 | | -from edx_toggles.toggles.testutils import override_waffle_flag |
9 | 8 |
|
10 | 9 | from django.utils.translation import get_language |
11 | 10 | from xblock.core import XBlock |
|
14 | 13 | from xmodule.modulestore.tests.factories import CourseFactory, BlockFactory |
15 | 14 | from xmodule.tests.test_export import PureXBlock |
16 | 15 |
|
17 | | -from cms.djangoapps.contentstore import toggles |
18 | | -from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient |
19 | 16 | from cms.djangoapps.contentstore.views.preview import _prepare_runtime_for_preview |
20 | | -from common.djangoapps.student.tests.factories import UserFactory |
21 | 17 |
|
22 | 18 |
|
23 | 19 | class FakeTranslations(XBlockI18nService): |
@@ -166,101 +162,3 @@ def test_i18n_service_callable(self): |
166 | 162 | Test: i18n service should be callable in studio. |
167 | 163 | """ |
168 | 164 | self.assertTrue(callable(self.block.runtime._services.get('i18n'))) # pylint: disable=protected-access |
169 | | - |
170 | | - |
171 | | -class InternationalizationTest(ModuleStoreTestCase): |
172 | | - """ |
173 | | - Tests to validate Internationalization. |
174 | | - """ |
175 | | - |
176 | | - CREATE_USER = False |
177 | | - |
178 | | - def setUp(self): |
179 | | - """ |
180 | | - These tests need a user in the DB so that the django Test Client |
181 | | - can log them in. |
182 | | - They inherit from the ModuleStoreTestCase class so that the mongodb collection |
183 | | - will be cleared out before each test case execution and deleted |
184 | | - afterwards. |
185 | | - """ |
186 | | - super().setUp() |
187 | | - |
188 | | - self.uname = 'testuser' |
189 | | - |
190 | | - self.password = self.TEST_PASSWORD |
191 | | - |
192 | | - # Create the use so we can log them in. |
193 | | - self.user = UserFactory.create(username=self.uname, email=self.email, password=self.password) |
194 | | - |
195 | | - # Note that we do not actually need to do anything |
196 | | - # for registration if we directly mark them active. |
197 | | - self.user.is_active = True |
198 | | - # Staff has access to view all courses |
199 | | - self.user.is_staff = True |
200 | | - self.user.save() |
201 | | - |
202 | | - self.course_data = { |
203 | | - 'org': 'MITx', |
204 | | - 'number': '999', |
205 | | - 'display_name': 'Robot Super Course', |
206 | | - } |
207 | | - |
208 | | - @override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True) |
209 | | - def test_course_plain_english(self): |
210 | | - """Test viewing the index page with no courses""" |
211 | | - self.client = AjaxEnabledTestClient() # lint-amnesty, pylint: disable=attribute-defined-outside-init |
212 | | - self.client.login(username=self.uname, password=self.password) |
213 | | - |
214 | | - resp = self.client.get_html('/home/') |
215 | | - self.assertContains(resp, |
216 | | - '<h1 class="page-header">𝓢𝓽𝓾𝓭𝓲𝓸 Home</h1>', |
217 | | - status_code=200, |
218 | | - html=True) |
219 | | - |
220 | | - @override_waffle_flag(toggles.LEGACY_STUDIO_HOME, True) |
221 | | - def test_course_explicit_english(self): |
222 | | - """Test viewing the index page with no courses""" |
223 | | - self.client = AjaxEnabledTestClient() # lint-amnesty, pylint: disable=attribute-defined-outside-init |
224 | | - self.client.login(username=self.uname, password=self.password) |
225 | | - |
226 | | - resp = self.client.get_html( |
227 | | - '/home/', |
228 | | - {}, |
229 | | - HTTP_ACCEPT_LANGUAGE='en', |
230 | | - ) |
231 | | - |
232 | | - self.assertContains(resp, |
233 | | - '<h1 class="page-header">𝓢𝓽𝓾𝓭𝓲𝓸 Home</h1>', |
234 | | - status_code=200, |
235 | | - html=True) |
236 | | - |
237 | | - # **** |
238 | | - # NOTE: |
239 | | - # **** |
240 | | - # |
241 | | - # This test will break when we replace this fake 'test' language |
242 | | - # with actual Esperanto. This test will need to be updated with |
243 | | - # actual Esperanto at that time. |
244 | | - # Test temporarily disable since it depends on creation of dummy strings |
245 | | - @skip |
246 | | - def test_course_with_accents(self): |
247 | | - """Test viewing the index page with no courses""" |
248 | | - self.client = AjaxEnabledTestClient() # lint-amnesty, pylint: disable=attribute-defined-outside-init |
249 | | - self.client.login(username=self.uname, password=self.password) |
250 | | - |
251 | | - resp = self.client.get_html( |
252 | | - '/home/', |
253 | | - {}, |
254 | | - HTTP_ACCEPT_LANGUAGE='eo' |
255 | | - ) |
256 | | - |
257 | | - TEST_STRING = ( |
258 | | - '<h1 class="title-1">' |
259 | | - 'My \xc7\xf6\xfcrs\xe9s L#' |
260 | | - '</h1>' |
261 | | - ) |
262 | | - |
263 | | - self.assertContains(resp, |
264 | | - TEST_STRING, |
265 | | - status_code=200, |
266 | | - html=True) |
0 commit comments