7171from lms .djangoapps .courseware .tests .helpers import MasqueradeMixin , get_expiration_banner_text
7272from lms .djangoapps .courseware .testutils import RenderXBlockTestMixin
7373from lms .djangoapps .courseware .toggles import (
74- COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR ,
75- COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR ,
7674 COURSEWARE_MICROFRONTEND_SEARCH_ENABLED ,
7775 COURSEWARE_OPTIMIZED_RENDER_XBLOCK ,
7876)
@@ -3251,13 +3249,10 @@ def setUp(self):
32513249 self .client = APIClient ()
32523250 self .apiUrl = reverse ('courseware_navigation_sidebar_toggles_view' , kwargs = {'course_id' : str (self .course .id )})
32533251
3254- @override_waffle_flag (COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR , active = True )
3255- @override_waffle_flag (COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR , active = False )
32563252 @override_waffle_switch (ENABLE_COMPLETION_TRACKING_SWITCH , active = False )
3257- def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track_disabled (self ):
3253+ def test_courseware_mfe_navigation_sidebar_completion_track_disabled (self ):
32583254 """
3259- Getter to check if it is allowed to show the Courseware navigation sidebar to a user
3260- and auxiliary sidebar doesn't open.
3255+ Getter to check if completion tracking is disabled.
32613256 """
32623257 response = self .client .get (self .apiUrl , content_type = 'application/json' )
32633258 body = json .loads (response .content .decode ('utf-8' ))
@@ -3266,19 +3261,14 @@ def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track
32663261 self .assertEqual (
32673262 body ,
32683263 {
3269- "enable_navigation_sidebar" : True ,
3270- "always_open_auxiliary_sidebar" : False ,
32713264 "enable_completion_tracking" : False ,
32723265 },
32733266 )
32743267
3275- @override_waffle_flag (COURSEWARE_MICROFRONTEND_ENABLE_NAVIGATION_SIDEBAR , active = True )
3276- @override_waffle_flag (COURSEWARE_MICROFRONTEND_ALWAYS_OPEN_AUXILIARY_SIDEBAR , active = False )
32773268 @override_waffle_switch (ENABLE_COMPLETION_TRACKING_SWITCH , active = True )
3278- def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track_enabled (self ):
3269+ def test_courseware_mfe_navigation_sidebar_completion_track_enabled (self ):
32793270 """
3280- Getter to check if it is allowed to show the Courseware navigation sidebar to a user
3281- and auxiliary sidebar doesn't open.
3271+ Getter to check if completion tracking is enabled.
32823272 """
32833273 response = self .client .get (self .apiUrl , content_type = 'application/json' )
32843274 body = json .loads (response .content .decode ('utf-8' ))
@@ -3287,132 +3277,6 @@ def test_courseware_mfe_navigation_sidebar_enabled_aux_disabled_completion_track
32873277 self .assertEqual (
32883278 body ,
32893279 {
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 ,
34163280 "enable_completion_tracking" : True ,
34173281 },
34183282 )
0 commit comments