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
5241b04b
Commit
5241b04b
authored
Sep 11, 2015
by
Matt Drayer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9689 from edx/ziafazal/SOL-1187
SOL-1187: missing is_active attribute fix
parents
87fcdb80
dd48bb0f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
1 deletions
+40
-1
cms/djangoapps/contentstore/views/certificates.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_certificates.py
+39
-0
No files found.
cms/djangoapps/contentstore/views/certificates.py
View file @
5241b04b
...
...
@@ -218,7 +218,7 @@ class CertificateManager(object):
# including the actual 'certificates' list that we're working with in this context
certificates
=
course
.
certificates
.
get
(
'certificates'
,
[])
if
only_active
:
certificates
=
[
certificate
for
certificate
in
certificates
if
certificate
[
'is_active'
]
]
certificates
=
[
certificate
for
certificate
in
certificates
if
certificate
.
get
(
'is_active'
,
False
)
]
return
certificates
@staticmethod
...
...
cms/djangoapps/contentstore/views/tests/test_certificates.py
View file @
5241b04b
...
...
@@ -446,6 +446,45 @@ class CertificatesDetailHandlerTestCase(EventTestMixin, CourseTestCase, Certific
self
.
assertEqual
(
course_certificates
[
1
]
.
get
(
'name'
),
u'New test certificate'
)
self
.
assertEqual
(
course_certificates
[
1
]
.
get
(
'description'
),
'New test description'
)
def
test_can_edit_certificate_without_is_active
(
self
):
"""
Tests user should be able to edit certificate, if is_active attribute is not present
for given certificate. Old courses might not have is_active attribute in certificate data.
"""
certificates
=
[
{
'id'
:
1
,
'name'
:
'certificate with is_active'
,
'description'
:
'Description '
,
'signatories'
:
[],
'version'
:
CERTIFICATE_SCHEMA_VERSION
,
}
]
self
.
course
.
certificates
=
{
'certificates'
:
certificates
}
self
.
save_course
()
expected
=
{
u'id'
:
1
,
u'version'
:
CERTIFICATE_SCHEMA_VERSION
,
u'name'
:
u'New test certificate'
,
u'description'
:
u'New test description'
,
u'is_active'
:
True
,
u'course_title'
:
u'Course Title Override'
,
u'signatories'
:
[]
}
response
=
self
.
client
.
post
(
self
.
_url
(
cid
=
1
),
data
=
json
.
dumps
(
expected
),
content_type
=
"application/json"
,
HTTP_ACCEPT
=
"application/json"
,
HTTP_X_REQUESTED_WITH
=
"XMLHttpRequest"
,
)
self
.
assertEqual
(
response
.
status_code
,
201
)
content
=
json
.
loads
(
response
.
content
)
self
.
assertEqual
(
content
,
expected
)
def
test_can_delete_certificate_with_signatories
(
self
):
"""
Delete certificate
...
...
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