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
464bcf33
Commit
464bcf33
authored
Mar 31, 2015
by
Will Daly
Committed by
Adam Palay
Apr 02, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show certificates for all verified modes
parent
62a515f0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
common/djangoapps/student/tests/test_certificates.py
+54
-0
lms/templates/dashboard/_dashboard_certificate_information.html
+5
-2
No files found.
common/djangoapps/student/tests/test_certificates.py
0 → 100644
View file @
464bcf33
"""Tests for display of certificates on the student dashboard. """
import
unittest
import
ddt
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
certificates.tests.factories
import
GeneratedCertificateFactory
# pylint: disable=import-error
@ddt.ddt
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
CertificateDisplayTest
(
ModuleStoreTestCase
):
"""Tests display of certificates on the student dashboard. """
USERNAME
=
"test_user"
PASSWORD
=
"password"
DOWNLOAD_URL
=
"http://www.example.com/certificate.pdf"
def
setUp
(
self
):
super
(
CertificateDisplayTest
,
self
)
.
setUp
()
self
.
user
=
UserFactory
.
create
(
username
=
self
.
USERNAME
,
password
=
self
.
PASSWORD
)
result
=
self
.
client
.
login
(
username
=
self
.
USERNAME
,
password
=
self
.
PASSWORD
)
self
.
assertTrue
(
result
,
msg
=
"Could not log in"
)
self
.
course
=
CourseFactory
()
self
.
course
.
certificates_display_behavior
=
"early_with_info"
self
.
update_course
(
self
.
course
,
self
.
user
.
username
)
@ddt.data
(
'verified'
,
'professional'
)
def
test_display_verified_certificate
(
self
,
enrollment_mode
):
self
.
_create_certificate
(
enrollment_mode
)
self
.
_check_can_download_certificate
()
def
_create_certificate
(
self
,
enrollment_mode
):
"""Simulate that the user has a generated certificate. """
CourseEnrollmentFactory
.
create
(
user
=
self
.
user
,
course_id
=
self
.
course
.
id
,
mode
=
enrollment_mode
)
GeneratedCertificateFactory
(
user
=
self
.
user
,
course_id
=
self
.
course
.
id
,
mode
=
enrollment_mode
,
download_url
=
self
.
DOWNLOAD_URL
,
status
=
"downloadable"
,
grade
=
0.98
,
)
def
_check_can_download_certificate
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
self
.
assertContains
(
response
,
u'Download Your ID Verified'
)
self
.
assertContains
(
response
,
self
.
DOWNLOAD_URL
)
lms/templates/dashboard/_dashboard_certificate_information.html
View file @
464bcf33
<
%
page
args=
"cert_status, course, enrollment"
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
from
course_modes
.
models
import
CourseMode
%
>
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%
...
...
@@ -61,7 +64,7 @@ else:
<a
class=
"btn"
href=
"${cert_status['download_url']}"
title=
"${_('This link will open/download a PDF document')}"
>
${_("Download Your {cert_name_short} (PDF)").format(cert_name_short=cert_name_short)}
</a></li>
% elif cert_status['show_download_url'] and enrollment.mode
== 'verified'
:
% elif cert_status['show_download_url'] and enrollment.mode
in CourseMode.VERIFIED_MODES
:
<li
class=
"action"
>
<a
class=
"btn"
href=
"${cert_status['download_url']}"
title=
"${_('This link will open/download a PDF document of your verified {cert_name_long}.').format(cert_name_long=cert_name_long)}"
>
...
...
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