diff --git a/lms/djangoapps/courseware/masquerade.py b/lms/djangoapps/courseware/masquerade.py index 33485c5386..1be4d75c0a 100644 --- a/lms/djangoapps/courseware/masquerade.py +++ b/lms/djangoapps/courseware/masquerade.py @@ -4,7 +4,6 @@ Allow course staff to see a student or staff view of courseware. Which kind of view has been selected is stored in the session state. ''' - import logging from datetime import datetime @@ -49,6 +48,7 @@ class CourseMasquerade: """ Masquerade settings for a particular course. """ + def __init__(self, course_key, role='student', user_partition_id=None, group_id=None, user_name=None): # All parameters to this function must be named identically to the corresponding attribute. # If you remove or rename an attribute, also update the __setstate__() method to migrate @@ -131,7 +131,7 @@ class MasqueradeView(View): ], } if len(partitions) == 0: - data['available'].append( { + data['available'].append({ 'name': 'Learner', 'role': 'student', }) @@ -211,9 +211,9 @@ def setup_masquerade(request, course_key, staff_access=False, reset_masquerade_d If the reset_masquerade_data flag is set, the field data stored in the session will be cleared. """ if ( - request.user is None or - not settings.FEATURES.get('ENABLE_MASQUERADE', False) or - not staff_access + request.user is None or + not settings.FEATURES.get('ENABLE_MASQUERADE', False) or + not staff_access ): return None, request.user if reset_masquerade_data: @@ -414,6 +414,7 @@ class MasqueradingKeyValueStore(KeyValueStore): This `KeyValueStore` wraps an underlying `KeyValueStore`. Reads are forwarded to the underlying store, but writes go to a Django session (or other dictionary-like object). """ + def __init__(self, kvs, session): # lint-amnesty, pylint: disable=super-init-not-called """ Arguments: diff --git a/lms/djangoapps/courseware/tests/test_masquerade.py b/lms/djangoapps/courseware/tests/test_masquerade.py index 95578b3974..c0b730f034 100644 --- a/lms/djangoapps/courseware/tests/test_masquerade.py +++ b/lms/djangoapps/courseware/tests/test_masquerade.py @@ -172,7 +172,6 @@ class MasqueradeTestCase(SharedModuleStoreTestCase, LoginEnrollmentTestCase, Mas assert self.problem_display_name in problem_html assert show_answer_expected == ('Show answer' in problem_html) - def verify_learner_masquerade_available(self, learner_option_expected): """ Verifies if learner masquerade option is available