Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a7b960bb
Unverified
Commit
a7b960bb
authored
4 years ago
by
Carla Duarte
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #27016 from edx/ciduarte/AA-212
AA-212: add masquerade test for progress tab
parents
1f392bdc
dbe31e3c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lms/djangoapps/course_home_api/progress/v1/tests/test_views.py
+18
-14
18 additions, 14 deletions
...jangoapps/course_home_api/progress/v1/tests/test_views.py
with
18 additions
and
14 deletions
lms/djangoapps/course_home_api/progress/v1/tests/test_views.py
+
18
−
14
View file @
a7b960bb
...
...
@@ -79,17 +79,21 @@ class ProgressTabTestViews(BaseCourseHomeTests):
response
=
self
.
client
.
get
(
self
.
url
)
assert
response
.
status_code
==
404
# TODO: (AA-212) implement masquerade
# def test_masquerade(self):
# user = UserFactory()
# set_user_preference(user, 'time_zone', 'Asia/Tokyo')
# CourseEnrollment.enroll(user, self.course.id)
#
# self.switch_to_staff() # needed for masquerade
#
# # Sanity check on our normal user
# assert self.client.get(self.url).data['user_timezone'] is None
#
# # Now switch users and confirm we get a different result
# self.update_masquerade(username=user.username)
# assert self.client.get(self.url).data['user_timezone'] == 'Asia/Tokyo'
@override_experiment_waffle_flag
(
COURSE_HOME_MICROFRONTEND
,
active
=
True
)
@override_waffle_flag
(
COURSE_HOME_MICROFRONTEND_PROGRESS_TAB
,
active
=
True
)
def
test_masquerade
(
self
):
# Enroll a verified user
verified_user
=
UserFactory
(
is_staff
=
False
)
CourseEnrollment
.
enroll
(
verified_user
,
self
.
course
.
id
,
CourseMode
.
VERIFIED
)
# Enroll self in course
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course
.
id
)
response
=
self
.
client
.
get
(
self
.
url
)
assert
response
.
status_code
==
200
self
.
switch_to_staff
()
# needed for masquerade
assert
self
.
client
.
get
(
self
.
url
).
data
.
get
(
'
enrollment_mode
'
)
is
None
# Masquerade as verified user
self
.
update_masquerade
(
username
=
verified_user
.
username
)
assert
self
.
client
.
get
(
self
.
url
).
data
.
get
(
'
enrollment_mode
'
)
==
'
verified
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment