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
6d4f499b
Commit
6d4f499b
authored
May 05, 2017
by
Andy Armstrong
Committed by
GitHub
May 05, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15050 from edx/andya/fix-query-count-test
Fix broken Python certificate tests
parents
3d51bd08
480cf570
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
lms/djangoapps/certificates/models.py
+6
-0
lms/djangoapps/certificates/tests/test_api.py
+1
-0
lms/djangoapps/certificates/tests/test_webview_views.py
+2
-2
No files found.
lms/djangoapps/certificates/models.py
View file @
6d4f499b
...
@@ -302,6 +302,12 @@ class GeneratedCertificate(models.Model):
...
@@ -302,6 +302,12 @@ class GeneratedCertificate(models.Model):
else
:
else
:
return
query
.
values
(
'status'
)
.
annotate
(
count
=
Count
(
'status'
))
return
query
.
values
(
'status'
)
.
annotate
(
count
=
Count
(
'status'
))
def
__repr__
(
self
):
return
"<GeneratedCertificate: {course_id}, user={user}>"
.
format
(
course_id
=
self
.
course_id
,
user
=
self
.
user
)
def
invalidate
(
self
):
def
invalidate
(
self
):
"""
"""
Invalidate Generated Certificate by marking it 'unavailable'.
Invalidate Generated Certificate by marking it 'unavailable'.
...
...
lms/djangoapps/certificates/tests/test_api.py
View file @
6d4f499b
...
@@ -369,6 +369,7 @@ class CertificateGetTests(SharedModuleStoreTestCase):
...
@@ -369,6 +369,7 @@ class CertificateGetTests(SharedModuleStoreTestCase):
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
super
(
CertificateGetTests
,
cls
)
.
tearDownClass
()
cls
.
freezer
.
stop
()
cls
.
freezer
.
stop
()
def
test_get_certificate_for_user
(
self
):
def
test_get_certificate_for_user
(
self
):
...
...
lms/djangoapps/certificates/tests/test_webview_views.py
View file @
6d4f499b
...
@@ -721,7 +721,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
...
@@ -721,7 +721,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
course_id
=
unicode
(
self
.
course
.
id
)
course_id
=
unicode
(
self
.
course
.
id
)
)
)
self
.
cert
.
delete
()
self
.
cert
.
delete
()
self
.
assert
Equal
(
len
(
GeneratedCertificate
.
eligible_certificates
.
all
()),
0
)
self
.
assert
ListEqual
(
list
(
GeneratedCertificate
.
eligible_certificates
.
all
()),
[]
)
response
=
self
.
client
.
get
(
test_url
)
response
=
self
.
client
.
get
(
test_url
)
self
.
assertIn
(
'invalid'
,
response
.
content
)
self
.
assertIn
(
'invalid'
,
response
.
content
)
...
@@ -744,7 +744,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
...
@@ -744,7 +744,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
preview mode. Either the certificate is marked active or not.
preview mode. Either the certificate is marked active or not.
"""
"""
self
.
cert
.
delete
()
self
.
cert
.
delete
()
self
.
assert
Equal
(
len
(
GeneratedCertificate
.
eligible_certificates
.
all
()),
0
)
self
.
assert
ListEqual
(
list
(
GeneratedCertificate
.
eligible_certificates
.
all
()),
[]
)
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
2
)
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
2
)
test_url
=
get_certificate_url
(
test_url
=
get_certificate_url
(
user_id
=
self
.
user
.
id
,
user_id
=
self
.
user
.
id
,
...
...
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