Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a07da78a
Commit
a07da78a
authored
Apr 25, 2014
by
Waqas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the "VERIFIED_CERTIFICATES" toggle on dashboard
parent
316f25e6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
79 additions
and
21 deletions
+79
-21
common/djangoapps/student/tests/tests.py
+50
-3
lms/djangoapps/courseware/features/certificates.py
+1
-0
lms/envs/common.py
+3
-0
lms/envs/test.py
+2
-0
lms/templates/dashboard/_dashboard_course_listing.html
+23
-18
No files found.
common/djangoapps/student/tests/tests.py
View file @
a07da78a
...
@@ -12,10 +12,11 @@ import pytz
...
@@ -12,10 +12,11 @@ import pytz
from
django.conf
import
settings
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.test.client
import
RequestFactory
from
django.test.client
import
RequestFactory
,
Client
from
django.contrib.auth.models
import
User
,
AnonymousUser
from
django.contrib.auth.models
import
User
,
AnonymousUser
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
unittest.case
import
SkipTest
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -146,12 +147,58 @@ class DashboardTest(TestCase):
...
@@ -146,12 +147,58 @@ class DashboardTest(TestCase):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
(
org
=
self
.
COURSE_ORG
,
display_name
=
self
.
COURSE_NAME
,
number
=
self
.
COURSE_SLUG
)
self
.
course
=
CourseFactory
.
create
(
org
=
self
.
COURSE_ORG
,
display_name
=
self
.
COURSE_NAME
,
number
=
self
.
COURSE_SLUG
)
self
.
assertIsNotNone
(
self
.
course
)
self
.
assertIsNotNone
(
self
.
course
)
self
.
user
=
UserFactory
.
create
(
username
=
"jack"
,
email
=
"jack@fake.edx.org"
)
self
.
user
=
UserFactory
.
create
(
username
=
"jack"
,
email
=
"jack@fake.edx.org"
,
password
=
'test'
)
CourseModeFactory
.
create
(
CourseModeFactory
.
create
(
course_id
=
self
.
course
.
id
,
course_id
=
self
.
course
.
id
,
mode_slug
=
'honor'
,
mode_slug
=
'honor'
,
mode_display_name
=
'Honor Code'
,
mode_display_name
=
'Honor Code'
,
)
)
self
.
client
=
Client
()
def
check_verification_status_on
(
self
,
mode
,
value
):
"""
Check that the css class and the status message are in the dashboard html.
"""
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course
.
location
.
course_id
,
mode
=
mode
)
try
:
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
except
NoReverseMatch
:
raise
SkipTest
(
"Skip this test if url cannot be found (ie running from CMS tests)"
)
self
.
assertContains
(
response
,
"class=
\"
course {0}
\"
"
.
format
(
mode
))
self
.
assertContains
(
response
,
value
)
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
'ENABLE_VERIFIED_CERTIFICATES'
:
True
})
def
test_verification_status_visible
(
self
):
"""
Test that the certificate verification status for courses is visible on the dashboard.
"""
self
.
client
.
login
(
username
=
"jack"
,
password
=
"test"
)
self
.
check_verification_status_on
(
'verified'
,
'You
\'
re enrolled as a verified student'
)
self
.
check_verification_status_on
(
'honor'
,
'You
\'
re enrolled as an honor code student'
)
self
.
check_verification_status_on
(
'audit'
,
'You
\'
re auditing this course'
)
def
check_verification_status_off
(
self
,
mode
,
value
):
"""
Check that the css class and the status message are not in the dashboard html.
"""
CourseEnrollment
.
enroll
(
self
.
user
,
self
.
course
.
location
.
course_id
,
mode
=
mode
)
try
:
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
except
NoReverseMatch
:
raise
SkipTest
(
"Skip this test if url cannot be found (ie running from CMS tests)"
)
self
.
assertNotContains
(
response
,
"class=
\"
course {0}
\"
"
.
format
(
mode
))
self
.
assertNotContains
(
response
,
value
)
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
'ENABLE_VERIFIED_CERTIFICATES'
:
False
})
def
test_verification_status_invisible
(
self
):
"""
Test that the certificate verification status for courses is not visible on the dashboard
if the verified certificates setting is off.
"""
self
.
client
.
login
(
username
=
"jack"
,
password
=
"test"
)
self
.
check_verification_status_off
(
'verified'
,
'You
\'
re enrolled as a verified student'
)
self
.
check_verification_status_off
(
'honor'
,
'You
\'
re enrolled as an honor code student'
)
self
.
check_verification_status_off
(
'audit'
,
'You
\'
re auditing this course'
)
def
test_course_mode_info
(
self
):
def
test_course_mode_info
(
self
):
verified_mode
=
CourseModeFactory
.
create
(
verified_mode
=
CourseModeFactory
.
create
(
...
...
lms/djangoapps/courseware/features/certificates.py
View file @
a07da78a
...
@@ -6,6 +6,7 @@ from lettuce.django import django_url
...
@@ -6,6 +6,7 @@ from lettuce.django import django_url
from
course_modes.models
import
CourseMode
from
course_modes.models
import
CourseMode
from
nose.tools
import
assert_equal
from
nose.tools
import
assert_equal
UPSELL_LINK_CSS
=
'.message-upsell a.action-upgrade[href*="edx/999/Certificates"]'
UPSELL_LINK_CSS
=
'.message-upsell a.action-upgrade[href*="edx/999/Certificates"]'
def
create_cert_course
():
def
create_cert_course
():
...
...
lms/envs/common.py
View file @
a07da78a
...
@@ -172,6 +172,9 @@ FEATURES = {
...
@@ -172,6 +172,9 @@ FEATURES = {
# Enable instructor dash beta version link
# Enable instructor dash beta version link
'ENABLE_INSTRUCTOR_BETA_DASHBOARD'
:
True
,
'ENABLE_INSTRUCTOR_BETA_DASHBOARD'
:
True
,
# Toggle to enable certificates of courses on dashboard
'ENABLE_VERIFIED_CERTIFICATES'
:
False
,
# Allow use of the hint managment instructor view.
# Allow use of the hint managment instructor view.
'ENABLE_HINTER_INSTRUCTOR_VIEW'
:
False
,
'ENABLE_HINTER_INSTRUCTOR_VIEW'
:
False
,
...
...
lms/envs/test.py
View file @
a07da78a
...
@@ -37,6 +37,8 @@ FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True
...
@@ -37,6 +37,8 @@ FEATURES['ENABLE_INSTRUCTOR_BETA_DASHBOARD'] = True
FEATURES
[
'ENABLE_SHOPPING_CART'
]
=
True
FEATURES
[
'ENABLE_SHOPPING_CART'
]
=
True
FEATURES
[
'ENABLE_VERIFIED_CERTIFICATES'
]
=
True
# Enable this feature for course staff grade downloads, to enable acceptance tests
# Enable this feature for course staff grade downloads, to enable acceptance tests
FEATURES
[
'ENABLE_S3_GRADE_DOWNLOADS'
]
=
True
FEATURES
[
'ENABLE_S3_GRADE_DOWNLOADS'
]
=
True
FEATURES
[
'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'
]
=
True
FEATURES
[
'ALLOW_COURSE_STAFF_GRADE_DOWNLOADS'
]
=
True
...
...
lms/templates/dashboard/_dashboard_course_listing.html
View file @
a07da78a
...
@@ -21,7 +21,11 @@
...
@@ -21,7 +21,11 @@
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<li
class=
"course-item"
>
<li
class=
"course-item"
>
<article
class=
"course ${enrollment.mode}"
>
% if settings.FEATURES.get('ENABLE_VERIFIED_CERTIFICATES'):
<article
class=
"course ${enrollment.mode}"
>
% else:
<article
class=
"course"
>
%endif
<
%
<
%
course_target =
reverse('info',
args=
[course.id])
course_target =
reverse('info',
args=
[course.id])
%
>
%
>
...
@@ -35,23 +39,24 @@
...
@@ -35,23 +39,24 @@
<img
src=
"${course_image_url(course)}"
alt=
"${_('{course_number} {course_name} Cover Image').format(course_number=course.number, course_name=course.display_name_with_default) | h}"
/>
<img
src=
"${course_image_url(course)}"
alt=
"${_('{course_number} {course_name} Cover Image').format(course_number=course.number, course_name=course.display_name_with_default) | h}"
/>
</div>
</div>
% endif
% endif
% if settings.FEATURES.get('ENABLE_VERIFIED_CERTIFICATES'):
% if enrollment.mode == "verified":
% if enrollment.mode == "verified":
<span
class=
"sts-enrollment"
title=
"${_("
You
'
re
enrolled
as
a
verified
student
")}"
>
<span
class=
"sts-enrollment"
title=
"${_("
You
'
re
enrolled
as
a
verified
student
")}"
>
<span
class=
"label"
>
${_("Enrolled as: ")}
</span>
<span
class=
"label"
>
${_("Enrolled as: ")}
</span>
<img
class=
"deco-graphic"
src=
"${static.url('images/vcert-ribbon-s.png')}"
alt=
"ID Verified Ribbon/Badge"
/>
<img
class=
"deco-graphic"
src=
"${static.url('images/vcert-ribbon-s.png')}"
alt=
"ID Verified Ribbon/Badge"
/>
<span
class=
"sts-enrollment-value"
>
${_("Verified")}
</span>
<span
class=
"sts-enrollment-value"
>
${_("Verified")}
</span>
</span>
</span>
% elif enrollment.mode == "honor":
% elif enrollment.mode == "honor":
<span
class=
"sts-enrollment"
title=
"${_("
You
'
re
enrolled
as
an
honor
code
student
")}"
>
<span
class=
"sts-enrollment"
title=
"${_("
You
'
re
enrolled
as
an
honor
code
student
")}"
>
<span
class=
"label"
>
${_("Enrolled as: ")}
</span>
<span
class=
"label"
>
${_("Enrolled as: ")}
</span>
<span
class=
"sts-enrollment-value"
>
${_("Honor Code")}
</span>
<span
class=
"sts-enrollment-value"
>
${_("Honor Code")}
</span>
</span>
</span>
% elif enrollment.mode == "audit":
% elif enrollment.mode == "audit":
<span
class=
"sts-enrollment"
title=
"${_("
You
'
re
auditing
this
course
")}
>
<span
class=
"sts-enrollment"
title=
"${_("
You
'
re
auditing
this
course
")}
>
<span
class=
"label"
>
${_("Enrolled as: ")}
</span>
<span
class=
"label"
>
${_("Enrolled as: ")}
</span>
<span
class=
"sts-enrollment-value"
>
${_("Auditing")}
</span>
<span
class=
"sts-enrollment-value"
>
${_("Auditing")}
</span>
</span>
</span>
% endif
% endif
% endif
<section
class=
"info"
>
<section
class=
"info"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment