Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
f90f4276
Unverified
Commit
f90f4276
authored
7 years ago
by
Gabe Mulley
Browse files
Options
Downloads
Patches
Plain Diff
fix course sock for courses without verified modes
parent
44e5afba
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openedx/features/course_experience/tests/views/test_course_sock.py
+5
-10
5 additions, 10 deletions
...eatures/course_experience/tests/views/test_course_sock.py
openedx/features/course_experience/views/course_sock.py
+6
-2
6 additions, 2 deletions
openedx/features/course_experience/views/course_sock.py
with
11 additions
and
12 deletions
openedx/features/course_experience/tests/views/test_course_sock.py
+
5
−
10
View file @
f90f4276
...
...
@@ -4,6 +4,7 @@ Tests for course verification sock
import
ddt
from
commerce.models
import
CommerceConfiguration
from
course_modes.models
import
CourseMode
from
openedx.core.djangoapps.waffle_utils.testutils
import
override_waffle_flag
from
openedx.features.course_experience
import
DISPLAY_COURSE_SOCK_FLAG
...
...
@@ -50,6 +51,8 @@ class TestCourseSockView(SharedModuleStoreTestCase):
user
=
self
.
user
,
course_id
=
self
.
verified_course_already_enrolled
.
id
,
mode
=
CourseMode
.
VERIFIED
)
CommerceConfiguration
.
objects
.
create
(
enabled
=
True
,
checkout_on_ecommerce_service
=
True
)
# Log the user in
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
TEST_PASSWORD
)
...
...
@@ -90,15 +93,7 @@ class TestCourseSockView(SharedModuleStoreTestCase):
self
.
assert_verified_sock_is_not_visible
(
self
.
verified_course_already_enrolled
,
response
)
def
assert_verified_sock_is_visible
(
self
,
course
,
response
):
return
self
.
assertIn
(
TEST_VERIFICATION_SOCK_LOCATOR
,
response
.
content
,
msg
=
'
Student should be able to see sock if they have already upgraded to verified mode.
'
,
)
return
self
.
assertContains
(
response
,
TEST_VERIFICATION_SOCK_LOCATOR
,
html
=
False
)
def
assert_verified_sock_is_not_visible
(
self
,
course
,
response
):
return
self
.
assertNotIn
(
TEST_VERIFICATION_SOCK_LOCATOR
,
response
.
content
,
msg
=
'
Student should not be able to see sock in a unverifiable course.
'
,
)
return
self
.
assertNotContains
(
response
,
TEST_VERIFICATION_SOCK_LOCATOR
,
html
=
False
)
This diff is collapsed.
Click to expand it.
openedx/features/course_experience/views/course_sock.py
+
6
−
2
View file @
f90f4276
...
...
@@ -27,8 +27,12 @@ class CourseSockFragmentView(EdxFragmentView):
def
get_verification_context
(
request
,
course
):
enrollment
=
CourseEnrollment
.
get_enrollment
(
request
.
user
,
course
.
id
)
show_course_sock
=
verified_upgrade_link_is_valid
(
enrollment
)
and
get_language
()
==
'
en
'
upgrade_url
=
verified_upgrade_deadline_link
(
request
.
user
,
course
=
course
)
course_price
=
get_cosmetic_verified_display_price
(
course
)
if
show_course_sock
:
upgrade_url
=
verified_upgrade_deadline_link
(
request
.
user
,
course
=
course
)
course_price
=
get_cosmetic_verified_display_price
(
course
)
else
:
upgrade_url
=
''
course_price
=
''
context
=
{
'
show_course_sock
'
:
show_course_sock
,
...
...
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