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
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
dbe31e3c
Commit
dbe31e3c
authored
4 years ago
by
Carla Duarte
Browse files
Options
Downloads
Patches
Plain Diff
AA-212: add masquerade test for progress tab
parent
e93f0358
Branches
Branches containing commit
Tags
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 @
dbe31e3c
...
...
@@ -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%
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