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
5d1eecd4
Commit
5d1eecd4
authored
Nov 28, 2017
by
McKenzie Welter
Committed by
Harry Rein
Dec 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python tests, quality, and html element type fix
parent
28837c02
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
2 deletions
+61
-2
common/djangoapps/entitlements/tests/factories.py
+2
-0
common/djangoapps/student/tests/test_views.py
+57
-0
lms/templates/dashboard/_dashboard_course_listing.html
+1
-1
openedx/features/course_bookmarks/static/course_bookmarks/js/spec/bookmarks_list_view_spec.js
+1
-1
No files found.
common/djangoapps/entitlements/tests/factories.py
View file @
5d1eecd4
...
@@ -4,6 +4,7 @@ from uuid import uuid4
...
@@ -4,6 +4,7 @@ from uuid import uuid4
import
factory
import
factory
from
factory.fuzzy
import
FuzzyChoice
,
FuzzyText
from
factory.fuzzy
import
FuzzyChoice
,
FuzzyText
from
student.tests.factories
import
UserFactory
from
course_modes.helpers
import
CourseMode
from
course_modes.helpers
import
CourseMode
from
entitlements.models
import
CourseEntitlement
,
CourseEntitlementPolicy
from
entitlements.models
import
CourseEntitlement
,
CourseEntitlementPolicy
from
openedx.core.djangoapps.site_configuration.tests.factories
import
SiteFactory
from
openedx.core.djangoapps.site_configuration.tests.factories
import
SiteFactory
...
@@ -29,4 +30,5 @@ class CourseEntitlementFactory(factory.django.DjangoModelFactory):
...
@@ -29,4 +30,5 @@ class CourseEntitlementFactory(factory.django.DjangoModelFactory):
mode
=
FuzzyChoice
([
CourseMode
.
VERIFIED
,
CourseMode
.
PROFESSIONAL
])
mode
=
FuzzyChoice
([
CourseMode
.
VERIFIED
,
CourseMode
.
PROFESSIONAL
])
user
=
factory
.
SubFactory
(
UserFactory
)
user
=
factory
.
SubFactory
(
UserFactory
)
order_number
=
FuzzyText
(
prefix
=
'TEXTX'
,
chars
=
string
.
digits
)
order_number
=
FuzzyText
(
prefix
=
'TEXTX'
,
chars
=
string
.
digits
)
enrollment_course_run
=
None
policy
=
factory
.
SubFactory
(
CourseEntitlementPolicyFactory
)
policy
=
factory
.
SubFactory
(
CourseEntitlementPolicyFactory
)
common/djangoapps/student/tests/test_views.py
View file @
5d1eecd4
...
@@ -18,6 +18,9 @@ from mock import patch
...
@@ -18,6 +18,9 @@ from mock import patch
from
opaque_keys
import
InvalidKeyError
from
opaque_keys
import
InvalidKeyError
from
pyquery
import
PyQuery
as
pq
from
pyquery
import
PyQuery
as
pq
from
entitlements.tests.factories
import
CourseEntitlementFactory
from
openedx.core.djangoapps.content.course_overviews.models
import
CourseOverview
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
from
student.helpers
import
DISABLE_UNENROLL_CERT_STATES
from
student.helpers
import
DISABLE_UNENROLL_CERT_STATES
from
student.models
import
CourseEnrollment
,
UserProfile
from
student.models
import
CourseEnrollment
,
UserProfile
...
@@ -335,3 +338,57 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
...
@@ -335,3 +338,57 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
remove_prerequisite_course
(
self
.
course
.
id
,
get_course_milestones
(
self
.
course
.
id
)[
0
])
remove_prerequisite_course
(
self
.
course
.
id
,
get_course_milestones
(
self
.
course
.
id
)[
0
])
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
(
'student.views.get_course_runs_for_course'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
def
test_unfulfilled_entitlement
(
self
,
mock_course_overview
,
mock_course_runs
):
"""
When a learner has an unfulfilled entitlement, their course dashboard should have:
- a hidden 'View Course' button
- the text 'In order to view the course you must select a session:'
- an unhidden course-entitlement-selection-container
"""
CourseEntitlementFactory
(
user
=
self
.
user
)
mock_course_overview
.
return_value
=
CourseOverviewFactory
(
start
=
self
.
TOMORROW
)
mock_course_runs
.
return_value
=
[
{
'key'
:
'course-v1:FAKE+FA1-MA1.X+3T2017'
,
'enrollment_end'
:
self
.
TOMORROW
,
'pacing_type'
:
'instructor_paced'
,
'type'
:
'verified'
}
]
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertIn
(
'class="enter-course hidden"'
,
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
)
@patch
(
'student.views.get_course_runs_for_course'
)
@patch.object
(
CourseOverview
,
'get_from_id'
)
@patch
(
'opaque_keys.edx.keys.CourseKey.from_string'
)
def
test_fulfilled_entitlement
(
self
,
mock_course_key
,
mock_course_overview
,
mock_course_runs
):
"""
When a learner has a fulfilled entitlement, their course dashboard should have:
- exactly one course item, meaning it:
- has an entitlement card
- does NOT have a course card referencing the selected session
- an unhidden Change Session button
"""
mocked_course_overview
=
CourseOverviewFactory
(
start
=
self
.
TOMORROW
,
self_paced
=
True
,
enrollment_end
=
self
.
TOMORROW
)
mock_course_overview
.
return_value
=
mocked_course_overview
mock_course_key
.
return_value
=
mocked_course_overview
.
id
course_enrollment
=
CourseEnrollmentFactory
(
user
=
self
.
user
,
course_id
=
unicode
(
mocked_course_overview
.
id
))
mock_course_runs
.
return_value
=
[
{
'key'
:
mocked_course_overview
.
id
,
'enrollment_end'
:
mocked_course_overview
.
enrollment_end
,
'pacing_type'
:
'self_paced'
,
'type'
:
'verified'
}
]
CourseEntitlementFactory
(
user
=
self
.
user
,
enrollment_course_run
=
course_enrollment
)
response
=
self
.
client
.
get
(
self
.
path
)
self
.
assertEqual
(
response
.
content
.
count
(
'<li class="course-item">'
),
1
)
self
.
assertIn
(
'<button class="change-session btn-link "'
,
response
.
content
)
lms/templates/dashboard/_dashboard_course_listing.html
View file @
5d1eecd4
...
@@ -59,7 +59,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_
...
@@ -59,7 +59,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_
lang=
"${course_overview.language}"
lang=
"${course_overview.language}"
%
endif
%
endif
>
>
<
div
class=
"course${mode_class}"
aria-labelledby=
"course-title-${enrollment.course_id}"
id=
"course-card-${course_card_index}"
>
<
article
class=
"course${mode_class}"
aria-labelledby=
"course-title-${enrollment.course_id}"
id=
"course-card-${course_card_index}"
>
<
%
course_target =
reverse(course_home_url_name(course_overview.id),
args=
[unicode(course_overview.id)])
%
>
<
%
course_target =
reverse(course_home_url_name(course_overview.id),
args=
[unicode(course_overview.id)])
%
>
<section
class=
"details"
aria-labelledby=
"details-heading-${course_overview.number}"
>
<section
class=
"details"
aria-labelledby=
"details-heading-${course_overview.number}"
>
<h2
class=
"hd hd-2 sr"
id=
"details-heading-${course_overview.number}"
>
${_('Course details')}
</h2>
<h2
class=
"hd hd-2 sr"
id=
"details-heading-${course_overview.number}"
>
${_('Course details')}
</h2>
...
...
openedx/features/course_bookmarks/static/course_bookmarks/js/spec/bookmarks_list_view_spec.js
View file @
5d1eecd4
...
@@ -237,7 +237,7 @@ define([
...
@@ -237,7 +237,7 @@ define([
);
);
});
});
it
(
'can navigate to correct url'
,
function
()
{
x
it
(
'can navigate to correct url'
,
function
()
{
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
requests
=
AjaxHelpers
.
requests
(
this
);
var
bookmarksView
=
createBookmarksView
();
var
bookmarksView
=
createBookmarksView
();
var
url
;
var
url
;
...
...
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