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
e63f0f92
Commit
e63f0f92
authored
Dec 17, 2015
by
Bill DeRusha
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10984 from edx/bderusha/studio-audit-cert
Disable certificate template creation for audit only courses
parents
0dce7efd
08d1268c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
2 deletions
+57
-2
cms/djangoapps/contentstore/views/certificates.py
+5
-1
cms/djangoapps/contentstore/views/tests/test_certificates.py
+35
-0
cms/templates/certificates.html
+9
-1
common/test/acceptance/tests/studio/test_studio_settings_certificates.py
+8
-0
No files found.
cms/djangoapps/contentstore/views/certificates.py
View file @
e63f0f92
...
...
@@ -359,7 +359,10 @@ def certificates_list_handler(request, course_key_string):
course_id
=
course
.
id
,
include_expired
=
True
)
if
mode
.
slug
!=
'audit'
]
if
len
(
course_modes
)
>
0
:
has_certificate_modes
=
len
(
course_modes
)
>
0
if
has_certificate_modes
:
certificate_web_view_url
=
get_lms_link_for_certificate_web_view
(
user_id
=
request
.
user
.
id
,
course_key
=
course_key
,
...
...
@@ -382,6 +385,7 @@ def certificates_list_handler(request, course_key_string):
'course_outline_url'
:
course_outline_url
,
'upload_asset_url'
:
upload_asset_url
,
'certificates'
:
certificates
,
'has_certificate_modes'
:
has_certificate_modes
,
'course_modes'
:
course_modes
,
'certificate_web_view_url'
:
certificate_web_view_url
,
'is_active'
:
is_active
,
...
...
cms/djangoapps/contentstore/views/tests/test_certificates.py
View file @
e63f0f92
...
...
@@ -195,6 +195,7 @@ class CertificatesBaseTestCase(object):
self
.
assertTrue
(
'must have name of the certificate'
in
context
.
exception
)
@ddt.ddt
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
class
CertificatesListHandlerTestCase
(
EventTestMixin
,
CourseTestCase
,
CertificatesBaseTestCase
,
HelperMethods
):
"""
...
...
@@ -340,6 +341,40 @@ class CertificatesListHandlerTestCase(EventTestMixin, CourseTestCase, Certificat
self
.
assertContains
(
response
,
'verified'
)
self
.
assertNotContains
(
response
,
'audit'
)
def
test_audit_only_disables_cert
(
self
):
"""
Tests audit course mode is skipped when rendering certificates page.
"""
CourseModeFactory
.
create
(
course_id
=
self
.
course
.
id
,
mode_slug
=
'audit'
)
response
=
self
.
client
.
get_html
(
self
.
_url
(),
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertContains
(
response
,
'This course does not use a mode that offers certificates.'
)
self
.
assertNotContains
(
response
,
'This module is not enabled.'
)
self
.
assertNotContains
(
response
,
'Loading'
)
@ddt.data
(
[
'audit'
,
'verified'
],
[
'verified'
],
[
'audit'
,
'verified'
,
'credit'
],
[
'verified'
,
'credit'
],
[
'professional'
]
)
def
test_non_audit_enables_cert
(
self
,
slugs
):
"""
Tests audit course mode is skipped when rendering certificates page.
"""
for
slug
in
slugs
:
CourseModeFactory
.
create
(
course_id
=
self
.
course
.
id
,
mode_slug
=
slug
)
response
=
self
.
client
.
get_html
(
self
.
_url
(),
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertNotContains
(
response
,
'This course does not use a mode that offers certificates.'
)
self
.
assertNotContains
(
response
,
'This module is not enabled.'
)
self
.
assertContains
(
response
,
'Loading'
)
def
test_assign_unique_identifier_to_certificates
(
self
):
"""
Test certificates have unique ids
...
...
cms/templates/certificates.html
View file @
e63f0f92
...
...
@@ -30,7 +30,9 @@ CMS.User.isGlobalStaff = '${is_global_staff}'=='True' ? true : false;
<
%
block
name=
"requirejs"
>
require(["js/certificates/factories/certificates_page_factory"], function(CertificatesPageFactory) {
CertificatesPageFactory(${escape_json_dumps(certificates) | n}, "${certificate_url}", "${course_outline_url}", ${escape_json_dumps(course_modes) | n}, ${escape_json_dumps(certificate_web_view_url) | n}, ${escape_json_dumps(is_active) | n}, ${escape_json_dumps(certificate_activation_handler_url) | n} );
if(${escape_json_dumps(has_certificate_modes)}) {
CertificatesPageFactory(${escape_json_dumps(certificates) | n}, "${certificate_url}", "${course_outline_url}", ${escape_json_dumps(course_modes) | n}, ${escape_json_dumps(certificate_web_view_url) | n}, ${escape_json_dumps(is_active) | n}, ${escape_json_dumps(certificate_activation_handler_url) | n} );
}
});
</
%
block>
...
...
@@ -56,6 +58,12 @@ CMS.User.isGlobalStaff = '${is_global_staff}'=='True' ? true : false;
${_("This module is not enabled.")}
</p>
</div>
% elif not has_certificate_modes:
<div
class=
"notice notice-incontext notice-moduledisabled"
>
<p
class=
"copy"
>
${_("This course does not use a mode that offers certificates.")}
</p>
</div>
% else:
<div
class=
"ui-loading"
>
<p><span
class=
"spin"
><i
class=
"icon fa fa-refresh"
aria-hidden=
"true"
></i></span>
<span
class=
"copy"
>
${_("Loading")}
</span></p>
...
...
common/test/acceptance/tests/studio/test_studio_settings_certificates.py
View file @
e63f0f92
...
...
@@ -3,7 +3,9 @@ Acceptance tests for Studio's Setting pages
"""
import
re
import
uuid
from
.base_studio_test
import
StudioCourseTest
from
...pages.lms.create_mode
import
ModeCreationPage
from
...pages.studio.settings_certificates
import
CertificatesPage
from
...pages.studio.settings_advanced
import
AdvancedSettingsPage
...
...
@@ -28,6 +30,12 @@ class CertificatesTest(StudioCourseTest):
)
self
.
course_advanced_settings
=
dict
()
# Add a verified mode to the course
ModeCreationPage
(
self
.
browser
,
self
.
course_id
,
mode_slug
=
u'verified'
,
mode_display_name
=
u'Verified Certificate'
,
min_price
=
10
,
suggested_prices
=
'10,20'
)
.
visit
()
def
make_signatory_data
(
self
,
prefix
=
'First'
):
"""
Makes signatory dict which can be used in the tests to create certificates
...
...
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