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
15d80c7b
Unverified
Commit
15d80c7b
authored
Dec 11, 2017
by
Michael Terry
Committed by
GitHub
Dec 11, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16854 from edx/mikix/LEARNER-3504
Show related programs when unenrolled
parents
320fc3e5
25076e6a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
4 deletions
+10
-4
common/djangoapps/student/tests/test_views.py
+8
-2
lms/templates/dashboard.html
+1
-1
lms/templates/dashboard/_dashboard_course_listing.html
+1
-1
No files found.
common/djangoapps/student/tests/test_views.py
View file @
15d80c7b
...
@@ -19,6 +19,7 @@ from opaque_keys import InvalidKeyError
...
@@ -19,6 +19,7 @@ from opaque_keys import InvalidKeyError
from
pyquery
import
PyQuery
as
pq
from
pyquery
import
PyQuery
as
pq
from
entitlements.tests.factories
import
CourseEntitlementFactory
from
entitlements.tests.factories
import
CourseEntitlementFactory
from
openedx.core.djangoapps.catalog.tests.factories
import
ProgramFactory
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
from
openedx.core.djangoapps.content.course_overviews.tests.factories
import
CourseOverviewFactory
from
openedx.core.djangoapps.content.course_overviews.tests.factories
import
CourseOverviewFactory
from
student.cookies
import
get_user_info_cookie_data
from
student.cookies
import
get_user_info_cookie_data
...
@@ -339,16 +340,20 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
...
@@ -339,16 +340,20 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
response
=
self
.
client
.
get
(
reverse
(
'dashboard'
))
self
.
assertNotIn
(
'<div class="prerequisites">'
,
response
.
content
)
self
.
assertNotIn
(
'<div class="prerequisites">'
,
response
.
content
)
@patch
(
'openedx.core.djangoapps.programs.utils.get_programs'
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
def
test_unfulfilled_entitlement
(
self
,
mock_course_overview
,
mock_course_runs
):
def
test_unfulfilled_entitlement
(
self
,
mock_course_overview
,
mock_course_runs
,
mock_get_programs
):
"""
"""
When a learner has an unfulfilled entitlement, their course dashboard should have:
When a learner has an unfulfilled entitlement, their course dashboard should have:
- a hidden 'View Course' button
- a hidden 'View Course' button
- the text 'In order to view the course you must select a session:'
- the text 'In order to view the course you must select a session:'
- an unhidden course-entitlement-selection-container
- an unhidden course-entitlement-selection-container
- a related programs message
"""
"""
CourseEntitlementFactory
(
user
=
self
.
user
)
program
=
ProgramFactory
()
CourseEntitlementFactory
(
user
=
self
.
user
,
course_uuid
=
program
[
'courses'
][
0
][
'uuid'
])
mock_get_programs
.
return_value
=
[
program
]
mock_course_overview
.
return_value
=
CourseOverviewFactory
(
start
=
self
.
TOMORROW
)
mock_course_overview
.
return_value
=
CourseOverviewFactory
(
start
=
self
.
TOMORROW
)
mock_course_runs
.
return_value
=
[
mock_course_runs
.
return_value
=
[
{
{
...
@@ -362,6 +367,7 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
...
@@ -362,6 +367,7 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
self
.
assertIn
(
'class="enter-course hidden"'
,
response
.
content
)
self
.
assertIn
(
'class="enter-course hidden"'
,
response
.
content
)
self
.
assertIn
(
'You must select a session to access the course.'
,
response
.
content
)
self
.
assertIn
(
'You must select a session to access the course.'
,
response
.
content
)
self
.
assertIn
(
'<div class="course-entitlement-selection-container ">'
,
response
.
content
)
self
.
assertIn
(
'<div class="course-entitlement-selection-container ">'
,
response
.
content
)
self
.
assertIn
(
'Related Programs:'
,
response
.
content
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
...
...
lms/templates/dashboard.html
View file @
15d80c7b
...
@@ -167,7 +167,7 @@ from student.models import CourseEnrollment
...
@@ -167,7 +167,7 @@ from student.models import CourseEnrollment
is_course_blocked =
(session_id
in
block_courses
)
is_course_blocked =
(session_id
in
block_courses
)
course_verification_status =
verification_status_by_course.get(session_id,
{})
course_verification_status =
verification_status_by_course.get(session_id,
{})
course_requirements =
courses_requirements_not_met.get(session_id)
course_requirements =
courses_requirements_not_met.get(session_id)
related_programs =
inverted_programs.get(unicode(session_id))
related_programs =
inverted_programs.get(unicode(
entitlement.course_uuid
if
entitlement
else
session_id
))
show_consent_link =
(session_id
in
consent_required_courses
)
show_consent_link =
(session_id
in
consent_required_courses
)
course_overview =
enrollment.course_overview
course_overview =
enrollment.course_overview
%
>
%
>
...
...
lms/templates/dashboard/_dashboard_course_listing.html
View file @
15d80c7b
...
@@ -299,7 +299,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_
...
@@ -299,7 +299,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_
</
%
static:require
_module
>
</
%
static:require
_module
>
%endif
%endif
% if related_programs
and not entitlement
:
% if related_programs:
<div
class=
"message message-related-programs is-shown"
>
<div
class=
"message message-related-programs is-shown"
>
<span
class=
"related-programs-preface"
tabindex=
"0"
>
${_('Related Programs')}:
</span>
<span
class=
"related-programs-preface"
tabindex=
"0"
>
${_('Related Programs')}:
</span>
<ul>
<ul>
...
...
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