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
247cbfe5
Commit
247cbfe5
authored
Sep 01, 2017
by
Andy Armstrong
Committed by
GitHub
Sep 01, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15943 from edx/andya/fix-learner-profile
Fix learner profile bug and tests that didn't catch it
parents
94aed661
5128a4f5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
20 deletions
+16
-20
openedx/features/learner_profile/templates/learner_profile/learner-achievements-fragment.html
+2
-2
openedx/features/learner_profile/tests/views/__init__.py
+0
-0
openedx/features/learner_profile/tests/views/test_learner_profile.py
+14
-18
No files found.
openedx/features/learner_profile/templates/learner_profile/learner-achievements-fragment.html
View file @
247cbfe5
...
...
@@ -19,10 +19,10 @@ from openedx.core.djangolib.markup import HTML, Text
course =
certificate['course']
completion_date_message_html =
Text(_('Completed
{
completion_date_html
}')).
format
(
completion_date=
HTML(
completion_date
_html
=
HTML(
'<
span
'
'
class=
"localized-datetime start-date"
'
'
data-datetime=
"{completion_date
_html
}"
'
'
data-datetime=
"{completion_date}"
'
'
data-format=
"shortDate"
'
'
data-timezone=
"{user_timezone}"
'
'
data-language=
"{user_language}"
'
...
...
openedx/features/learner_profile/tests/views/__init__.py
0 → 100644
View file @
247cbfe5
openedx/features/learner_profile/tests/views/test_learner_profile.py
View file @
247cbfe5
...
...
@@ -4,20 +4,20 @@
import
datetime
import
ddt
from
certificates.tests.factories
import
GeneratedCertificateFactory
# pylint: disable=import-error
from
course_modes.models
import
CourseMode
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.test.client
import
RequestFactory
from
util.testing
import
UrlResetMixin
from
course_modes.models
import
CourseMode
from
certificates.tests.factories
import
GeneratedCertificateFactory
# pylint: disable=import-error
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
from
openedx.core.djangoapps.waffle_utils.testutils
import
override_waffle_flag
from
openedx.features.learner_profile.views.learner_profile
import
learner_profile_context
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
from
util.testing
import
UrlResetMixin
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
...
import
SHOW_ACHIEVEMENTS_FLAG
@ddt.ddt
class
LearnerProfileViewTest
(
UrlResetMixin
,
ModuleStoreTestCase
):
...
...
@@ -130,6 +130,7 @@ class LearnerProfileViewTest(UrlResetMixin, ModuleStoreTestCase):
)
@ddt.data
(
CourseMode
.
HONOR
,
CourseMode
.
PROFESSIONAL
,
CourseMode
.
VERIFIED
)
@override_waffle_flag
(
SHOW_ACHIEVEMENTS_FLAG
,
active
=
True
)
def
test_certificate_visibility
(
self
,
cert_mode
):
"""
Verify that certificates are displayed with the correct card mode.
...
...
@@ -138,27 +139,22 @@ class LearnerProfileViewTest(UrlResetMixin, ModuleStoreTestCase):
cert
=
self
.
_create_certificate
(
cert_mode
)
cert
.
save
()
request
=
RequestFactory
()
.
get
(
'/url'
)
request
.
user
=
self
.
user
context
=
learner_profile_context
(
request
,
self
.
user
.
username
,
self
.
user
.
is_staff
)
response
=
self
.
client
.
get
(
'/u/{username}'
.
format
(
username
=
self
.
user
.
username
))
self
.
assert
True
(
'card certificate-card mode-'
+
cert_mode
in
str
(
context
[
'achievements_fragment'
]
.
content
))
self
.
assert
Contains
(
response
,
'card certificate-card mode-{cert_mode}'
.
format
(
cert_mode
=
cert_mode
))
@ddt.data
(
True
,
False
)
@override_waffle_flag
(
SHOW_ACHIEVEMENTS_FLAG
,
active
=
True
)
def
test_no_certificate_visibility
(
self
,
own_profile
):
"""
Verify that the 'You haven't earned any certificates yet.' well appears on the user's
own profile when they do not have certificates and does not appear when viewing
another user that does not have any certificates.
"""
request
=
RequestFactory
()
.
get
(
'/url'
)
request
.
user
=
self
.
user
profile_username
=
self
.
user
.
username
if
own_profile
else
self
.
other_user
.
username
context
=
learner_profile_context
(
request
,
profile_username
,
self
.
user
.
is_staff
)
response
=
self
.
client
.
get
(
'/u/{username}'
.
format
(
username
=
profile_username
)
)
if
own_profile
:
content
=
str
(
context
[
'achievements_fragment'
]
.
content
)
self
.
assertIn
(
'icon fa fa-search'
,
content
)
self
.
assertIn
(
"You haven't earned any certificates yet"
,
content
)
self
.
assertContains
(
response
,
'You haven't earned any certificates yet.'
)
else
:
self
.
assert
IsNone
(
context
[
'achievements_fragment'
]
)
self
.
assert
NotContains
(
response
,
'You haven't earned any certificates yet.'
)
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