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
35d04bff
Commit
35d04bff
authored
Nov 12, 2015
by
asadiqbal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SOL-1385
parent
a8cca47c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
2 deletions
+67
-2
common/test/acceptance/fixtures/certificates.py
+26
-0
common/test/acceptance/pages/lms/instructor_dashboard.py
+7
-0
common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py
+27
-1
lms/djangoapps/instructor/views/instructor_dashboard.py
+1
-0
lms/templates/instructor/instructor_dashboard_2/certificates.html
+6
-1
No files found.
common/test/acceptance/fixtures/certificates.py
View file @
35d04bff
...
...
@@ -15,6 +15,13 @@ class CertificateConfigFixtureError(Exception):
pass
class
CertificateConfigUpdateFixtureError
(
Exception
):
"""
Error occurred while updating certificate config fixture.
"""
pass
class
CertificateConfigFixture
(
StudioApiFixture
):
"""
Fixture to create certificates configuration for a course
...
...
@@ -44,3 +51,22 @@ class CertificateConfigFixture(StudioApiFixture):
)
return
self
def
update_certificate
(
self
,
certificate_id
):
"""
Update the certificates config data to certificate endpoint.
"""
response
=
self
.
session
.
put
(
'{}/certificates/{}/{}'
.
format
(
STUDIO_BASE_URL
,
self
.
course_id
,
certificate_id
),
data
=
json
.
dumps
(
self
.
certificates
),
headers
=
self
.
headers
)
if
not
response
.
ok
:
raise
CertificateConfigUpdateFixtureError
(
"Could not update certificate {0}. Status was {1}"
.
format
(
json
.
dumps
(
self
.
certificates
),
response
.
status_code
)
)
return
self
common/test/acceptance/pages/lms/instructor_dashboard.py
View file @
35d04bff
...
...
@@ -1057,6 +1057,13 @@ class CertificatesPage(PageObject):
return
self
.
get_selector
(
'#btn-start-generating-certificates'
)
@property
def
generate_certificates_disabled_button
(
self
):
# pylint: disable=invalid-name
"""
Returns the disabled state of button
"""
return
self
.
get_selector
(
'#disabled-btn-start-generating-certificates'
)
@property
def
certificate_generation_status
(
self
):
"""
Returns certificate generation status message container.
...
...
common/test/acceptance/tests/lms/test_lms_instructor_dashboard.py
View file @
35d04bff
...
...
@@ -22,6 +22,7 @@ from ...pages.lms.problem import ProblemPage
from
...pages.lms.track_selection
import
TrackSelectionPage
from
...pages.lms.pay_and_verify
import
PaymentAndVerificationFlow
,
FakePaymentPage
from
common.test.acceptance.tests.helpers
import
disable_animations
from
...fixtures.certificates
import
CertificateConfigFixture
class
BaseInstructorDashboardTest
(
EventsTestMixin
,
UniqueCourseTest
):
...
...
@@ -589,12 +590,37 @@ class CertificatesTest(BaseInstructorDashboardTest):
def
setUp
(
self
):
super
(
CertificatesTest
,
self
)
.
setUp
()
self
.
course_fixture
=
CourseFixture
(
**
self
.
course_info
)
.
install
()
self
.
test_certificate_config
=
{
'id'
:
1
,
'name'
:
'Certificate name'
,
'description'
:
'Certificate description'
,
'course_title'
:
'Course title override'
,
'signatories'
:
[],
'version'
:
1
,
'is_active'
:
True
}
CourseFixture
(
**
self
.
course_info
)
.
install
()
self
.
cert_fixture
=
CertificateConfigFixture
(
self
.
course_id
,
self
.
test_certificate_config
)
self
.
cert_fixture
.
install
()
self
.
user_name
,
self
.
user_id
=
self
.
log_in_as_instructor
()
self
.
instructor_dashboard_page
=
self
.
visit_instructor_dashboard
()
self
.
certificates_section
=
self
.
instructor_dashboard_page
.
select_certificates
()
disable_animations
(
self
.
certificates_section
)
def
test_generate_certificates_buttons_is_disable
(
self
):
"""
Scenario: On the Certificates tab of the Instructor Dashboard, Generate Certificates button is disable.
Given that I am on the Certificates tab on the Instructor Dashboard
The instructor-generation and cert_html_view_enabled feature flags have been enabled
But the certificate is not active in settings.
Then I see a 'Generate Certificates' button disabled
"""
self
.
test_certificate_config
[
'is_active'
]
=
False
self
.
cert_fixture
.
update_certificate
(
1
)
self
.
browser
.
refresh
()
self
.
assertFalse
(
self
.
certificates_section
.
generate_certificates_button
.
visible
)
self
.
assertTrue
(
self
.
certificates_section
.
generate_certificates_disabled_button
.
visible
)
def
test_generate_certificates_buttons_is_visible
(
self
):
"""
Scenario: On the Certificates tab of the Instructor Dashboard, Generate Certificates button is visible.
...
...
lms/djangoapps/instructor/views/instructor_dashboard.py
View file @
35d04bff
...
...
@@ -299,6 +299,7 @@ def _section_certificates(course):
'enabled_for_course'
:
certs_api
.
cert_generation_enabled
(
course
.
id
),
'instructor_generation_enabled'
:
instructor_generation_enabled
,
'html_cert_enabled'
:
html_cert_enabled
,
'active_certificate'
:
certs_api
.
get_active_web_certificate
(
course
),
'certificate_statuses'
:
GeneratedCertificate
.
get_unique_statuses
(
course_key
=
course
.
id
),
'urls'
:
{
'generate_example_certificates'
:
reverse
(
...
...
lms/templates/instructor/instructor_dashboard_2/certificates.html
View file @
35d04bff
...
...
@@ -73,7 +73,12 @@ import json
<div
class=
"start-certificate-generation"
>
<h2>
${_("Generate Certificates")}
</h2>
<form
id=
"certificates-generating-form"
method=
"post"
action=
"${section_data['urls']['start_certificate_generation']}"
>
<input
type=
"button"
id=
"btn-start-generating-certificates"
value=
"${_('Generate Certificates')}"
data-endpoint=
"${section_data['urls']['start_certificate_generation']}"
/>
% if section_data['html_cert_enabled'] and section_data['active_certificate'] is None:
<p>
${_("Course certificate generation requires an activated web certificate configuration.")}
</p>
<input
type=
"button"
id=
"disabled-btn-start-generating-certificates"
class=
"is-disabled"
aria-disabled=
"true"
value=
"${_('Generate Certificates')}"
/>
% else:
<input
type=
"button"
id=
"btn-start-generating-certificates"
value=
"${_('Generate Certificates')}"
data-endpoint=
"${section_data['urls']['start_certificate_generation']}"
/>
%endif
</form>
<div
class=
"certificate-generation-status"
></div>
</div>
...
...
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