|
23 | 23 | from django.test.client import Client |
24 | 24 | from django.urls import reverse, reverse_lazy |
25 | 25 | from edx_django_utils.cache.utils import RequestCache |
26 | | -from edx_toggles.toggles.testutils import override_waffle_flag, override_waffle_switch |
| 26 | +from edx_toggles.toggles.testutils import override_waffle_flag |
27 | 27 | from freezegun import freeze_time |
28 | 28 | from opaque_keys.edx.keys import CourseKey, UsageKey |
29 | 29 | from pytz import UTC |
|
71 | 71 | from lms.djangoapps.courseware.tests.helpers import MasqueradeMixin, get_expiration_banner_text |
72 | 72 | from lms.djangoapps.courseware.testutils import RenderXBlockTestMixin |
73 | 73 | from lms.djangoapps.courseware.toggles import ( |
74 | | - COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, |
75 | | - COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, |
76 | 74 | COURSEWARE_MICROFRONTEND_SEARCH_ENABLED, |
77 | 75 | COURSEWARE_OPTIMIZED_RENDER_XBLOCK, |
78 | 76 | ) |
79 | | -from completion.waffle import ENABLE_COMPLETION_TRACKING_SWITCH |
80 | 77 | from lms.djangoapps.courseware.user_state_client import DjangoXBlockUserStateClient |
81 | 78 | from lms.djangoapps.courseware.views.views import ( |
82 | 79 | BasePublicVideoXBlockView, |
@@ -3238,186 +3235,6 @@ def test_inclusion_date_greater_than_course_start(self, start_date, expected_ena |
3238 | 3235 | self.assertEqual(body, {'enabled': expected_enabled}) |
3239 | 3236 |
|
3240 | 3237 |
|
3241 | | -class TestCoursewareMFENavigationSidebarTogglesAPI(SharedModuleStoreTestCase): |
3242 | | - """ |
3243 | | - Tests the endpoint to fetch the Courseware Navigation Sidebar waffle flags status. |
3244 | | - """ |
3245 | | - |
3246 | | - def setUp(self): |
3247 | | - super().setUp() |
3248 | | - |
3249 | | - self.course = CourseFactory.create() |
3250 | | - |
3251 | | - self.client = APIClient() |
3252 | | - self.apiUrl = reverse('courseware_navigation_sidebar_toggles_view', kwargs={'course_id': str(self.course.id)}) |
3253 | | - |
3254 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True) |
3255 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False) |
3256 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False) |
3257 | | - def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track_disabled(self): |
3258 | | - """ |
3259 | | - Getter to check if it is allowed to show the Courseware navigation sidebar to a user |
3260 | | - and auxiliary sidebar doesn't open. |
3261 | | - """ |
3262 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3263 | | - body = json.loads(response.content.decode('utf-8')) |
3264 | | - |
3265 | | - self.assertEqual(response.status_code, 200) |
3266 | | - self.assertEqual( |
3267 | | - body, |
3268 | | - { |
3269 | | - "enable_navigation_sidebar": True, |
3270 | | - "always_open_auxiliary_sidebar": False, |
3271 | | - "enable_completion_tracking": False, |
3272 | | - }, |
3273 | | - ) |
3274 | | - |
3275 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True) |
3276 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False) |
3277 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True) |
3278 | | - def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track_enabled(self): |
3279 | | - """ |
3280 | | - Getter to check if it is allowed to show the Courseware navigation sidebar to a user |
3281 | | - and auxiliary sidebar doesn't open. |
3282 | | - """ |
3283 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3284 | | - body = json.loads(response.content.decode('utf-8')) |
3285 | | - |
3286 | | - self.assertEqual(response.status_code, 200) |
3287 | | - self.assertEqual( |
3288 | | - body, |
3289 | | - { |
3290 | | - "enable_navigation_sidebar": True, |
3291 | | - "always_open_auxiliary_sidebar": False, |
3292 | | - "enable_completion_tracking": True, |
3293 | | - }, |
3294 | | - ) |
3295 | | - |
3296 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True) |
3297 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True) |
3298 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False) |
3299 | | - def test_courseware_mfe_navigation_sidebar_enabled_aux_enabled_completion_track_disabled(self): |
3300 | | - """ |
3301 | | - Getter to check if it is allowed to show the Courseware navigation sidebar to a user |
3302 | | - and auxiliary sidebar should always open. |
3303 | | - """ |
3304 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3305 | | - body = json.loads(response.content.decode('utf-8')) |
3306 | | - |
3307 | | - self.assertEqual(response.status_code, 200) |
3308 | | - self.assertEqual( |
3309 | | - body, |
3310 | | - { |
3311 | | - "enable_navigation_sidebar": True, |
3312 | | - "always_open_auxiliary_sidebar": True, |
3313 | | - "enable_completion_tracking": False, |
3314 | | - }, |
3315 | | - ) |
3316 | | - |
3317 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=True) |
3318 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True) |
3319 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True) |
3320 | | - def test_courseware_mfe_navigation_sidebar_enabled_aux_enabled_completion_track_enabled(self): |
3321 | | - """ |
3322 | | - Getter to check if it is allowed to show the Courseware navigation sidebar to a user |
3323 | | - and auxiliary sidebar should always open. |
3324 | | - """ |
3325 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3326 | | - body = json.loads(response.content.decode('utf-8')) |
3327 | | - |
3328 | | - self.assertEqual(response.status_code, 200) |
3329 | | - self.assertEqual( |
3330 | | - body, |
3331 | | - { |
3332 | | - "enable_navigation_sidebar": True, |
3333 | | - "always_open_auxiliary_sidebar": True, |
3334 | | - "enable_completion_tracking": True, |
3335 | | - }, |
3336 | | - ) |
3337 | | - |
3338 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False) |
3339 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True) |
3340 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False) |
3341 | | - def test_courseware_mfe_navigation_sidebar_disabled_aux_enabled_completion_track_disabled(self): |
3342 | | - """ |
3343 | | - Getter to check if the Courseware navigation sidebar shouldn't be shown to a user |
3344 | | - and auxiliary sidebar should always open. |
3345 | | - """ |
3346 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3347 | | - body = json.loads(response.content.decode('utf-8')) |
3348 | | - |
3349 | | - self.assertEqual(response.status_code, 200) |
3350 | | - self.assertEqual( |
3351 | | - body, |
3352 | | - { |
3353 | | - "enable_navigation_sidebar": False, |
3354 | | - "always_open_auxiliary_sidebar": True, |
3355 | | - "enable_completion_tracking": False, |
3356 | | - }, |
3357 | | - ) |
3358 | | - |
3359 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False) |
3360 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=True) |
3361 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True) |
3362 | | - def test_courseware_mfe_navigation_sidebar_disabled_aux_enabled_completion_track_enabled(self): |
3363 | | - """ |
3364 | | - Getter to check if the Courseware navigation sidebar shouldn't be shown to a user |
3365 | | - and auxiliary sidebar should always open. |
3366 | | - """ |
3367 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3368 | | - body = json.loads(response.content.decode('utf-8')) |
3369 | | - |
3370 | | - self.assertEqual(response.status_code, 200) |
3371 | | - self.assertEqual( |
3372 | | - body, |
3373 | | - { |
3374 | | - "enable_navigation_sidebar": False, |
3375 | | - "always_open_auxiliary_sidebar": True, |
3376 | | - "enable_completion_tracking": True, |
3377 | | - }, |
3378 | | - ) |
3379 | | - |
3380 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False) |
3381 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False) |
3382 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=False) |
3383 | | - def test_courseware_mfe_navigation_sidebar_toggles_disabled_completion_track_disabled(self): |
3384 | | - """ |
3385 | | - Getter to check if neither navigation sidebar nor auxiliary sidebar is shown. |
3386 | | - """ |
3387 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3388 | | - body = json.loads(response.content.decode('utf-8')) |
3389 | | - |
3390 | | - self.assertEqual(response.status_code, 200) |
3391 | | - self.assertEqual( |
3392 | | - body, |
3393 | | - { |
3394 | | - "enable_navigation_sidebar": False, |
3395 | | - "always_open_auxiliary_sidebar": False, |
3396 | | - "enable_completion_tracking": False, |
3397 | | - }, |
3398 | | - ) |
3399 | | - |
3400 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR, active=False) |
3401 | | - @override_waffle_flag(COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR, active=False) |
3402 | | - @override_waffle_switch(ENABLE_COMPLETION_TRACKING_SWITCH, active=True) |
3403 | | - def test_courseware_mfe_navigation_sidebar_toggles_disabled_completion_track_enabled(self): |
3404 | | - """ |
3405 | | - Getter to check if neither navigation sidebar nor auxiliary sidebar is shown. |
3406 | | - """ |
3407 | | - response = self.client.get(self.apiUrl, content_type='application/json') |
3408 | | - body = json.loads(response.content.decode('utf-8')) |
3409 | | - |
3410 | | - self.assertEqual(response.status_code, 200) |
3411 | | - self.assertEqual( |
3412 | | - body, |
3413 | | - { |
3414 | | - "enable_navigation_sidebar": False, |
3415 | | - "always_open_auxiliary_sidebar": False, |
3416 | | - "enable_completion_tracking": True, |
3417 | | - }, |
3418 | | - ) |
3419 | | - |
3420 | | - |
3421 | 3238 | @ddt.ddt |
3422 | 3239 | class CourseAboutViewTests(ModuleStoreTestCase): |
3423 | 3240 | """ |
|
0 commit comments