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
92a845e1
Commit
92a845e1
authored
Oct 20, 2015
by
Matt Drayer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10265 from edx/saleem-latif/SOL-1314
SOL-1314: Add Cert link to Support dashboard
parents
022a8736
aaf13b97
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletions
+27
-1
lms/djangoapps/certificates/api.py
+1
-1
lms/djangoapps/certificates/tests/test_support_views.py
+26
-0
No files found.
lms/djangoapps/certificates/api.py
View file @
92a845e1
...
...
@@ -71,7 +71,7 @@ def get_certificates_for_user(username):
# In the future, we can update this to construct a URL to the webview certificate
# for courses that have this feature enabled.
"download_url"
:
(
cert
.
download_url
cert
.
download_url
or
get_certificate_url
(
cert
.
user
.
id
,
cert
.
course_id
)
if
cert
.
status
==
CertificateStatuses
.
downloadable
else
None
),
...
...
lms/djangoapps/certificates/tests/test_support_views.py
View file @
92a845e1
...
...
@@ -5,8 +5,10 @@ Tests for certificate app views used by the support team.
import
json
import
ddt
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
opaque_keys.edx.keys
import
CourseKey
from
student.tests.factories
import
UserFactory
...
...
@@ -16,6 +18,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
certificates.models
import
GeneratedCertificate
,
CertificateStatuses
FEATURES_WITH_CERTS_ENABLED
=
settings
.
FEATURES
.
copy
()
FEATURES_WITH_CERTS_ENABLED
[
'CERTIFICATES_HTML_VIEW'
]
=
True
class
CertificateSupportTestCase
(
TestCase
):
"""
...
...
@@ -132,6 +137,27 @@ class CertificateSearchTests(CertificateSupportTestCase):
self
.
assertEqual
(
retrieved_cert
[
"grade"
],
unicode
(
self
.
CERT_GRADE
))
self
.
assertEqual
(
retrieved_cert
[
"status"
],
self
.
CERT_STATUS
)
self
.
assertEqual
(
retrieved_cert
[
"type"
],
self
.
CERT_MODE
)
self
.
assertEqual
(
retrieved_cert
[
"download_url"
],
self
.
CERT_DOWNLOAD_URL
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_download_link
(
self
):
self
.
cert
.
download_url
=
''
self
.
cert
.
save
()
response
=
self
.
_search
(
self
.
STUDENT_USERNAME
)
self
.
assertEqual
(
response
.
status_code
,
200
)
results
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
len
(
results
),
1
)
retrieved_cert
=
results
[
0
]
self
.
assertEqual
(
retrieved_cert
[
"download_url"
],
reverse
(
'certificates:html_view'
,
kwargs
=
{
"user_id"
:
self
.
student
.
id
,
"course_id"
:
self
.
CERT_COURSE_KEY
}
# pylint: disable=no-member
)
)
def
_search
(
self
,
query
):
"""Execute a search and return the response. """
...
...
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