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
bdd4f232
Commit
bdd4f232
authored
Sep 12, 2017
by
sanfordstudent
Committed by
GitHub
Sep 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15994 from edx/sstudent/fix_certs_tests
fix cert test
parents
c2e10e56
0bd8b199
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
lms/djangoapps/certificates/tests/test_webview_views.py
+36
-2
No files found.
lms/djangoapps/certificates/tests/test_webview_views.py
View file @
bdd4f232
...
...
@@ -12,7 +12,6 @@ from django.conf import settings
from
django.core.urlresolvers
import
reverse
from
django.test.client
import
Client
,
RequestFactory
from
django.test.utils
import
override_settings
from
freezegun
import
freeze_time
from
util.date_utils
import
strftime_localized
from
mock
import
patch
from
nose.plugins.attrib
import
attr
...
...
@@ -795,7 +794,42 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
self
.
assertIn
(
'course_title_0'
,
response
.
content
)
self
.
assertIn
(
'Signatory_Title 0'
,
response
.
content
)
@freeze_time
(
'2017-09-10 00:00:00Z'
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
@ddt.data
(
(
-
2
,
True
),
(
-
2
,
False
),
(
10
,
False
)
)
@ddt.unpack
def
test_html_view_certificate_available_date_for_instructor_paced_courses
(
self
,
cert_avail_delta
,
self_paced
):
"""
test certificate web view should display the certificate available date
as the issued date for instructor-paced courses
"""
self
.
course
.
self_paced
=
self_paced
today
=
datetime
.
datetime
.
today
()
self
.
course
.
certificate_available_date
=
today
+
datetime
.
timedelta
(
cert_avail_delta
)
self
.
store
.
update_item
(
self
.
course
,
self
.
user
.
id
)
self
.
_add_course_certificates
(
count
=
1
,
signatory_count
=
1
,
is_active
=
True
)
test_url
=
get_certificate_url
(
user_id
=
self
.
user
.
id
,
course_id
=
unicode
(
self
.
course
.
id
)
)
if
self_paced
or
self
.
course
.
certificate_available_date
>
today
:
expected_date
=
today
else
:
expected_date
=
self
.
course
.
certificate_available_date
with
waffle
.
waffle
()
.
override
(
waffle
.
SELF_PACED_ONLY
,
active
=
True
):
with
waffle
.
waffle
()
.
override
(
waffle
.
INSTRUCTOR_PACED_ONLY
,
active
=
True
):
response
=
self
.
client
.
get
(
test_url
)
date
=
'{month} {day}, {year}'
.
format
(
month
=
strftime_localized
(
expected_date
,
"
%
B"
),
day
=
expected_date
.
day
,
year
=
expected_date
.
year
)
self
.
assertIn
(
date
,
response
.
content
)
@override_settings
(
FEATURES
=
FEATURES_WITH_CERTS_ENABLED
)
def
test_render_html_view_invalid_certificate_configuration
(
self
):
self
.
course
.
cert_html_view_enabled
=
True
...
...
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