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
6f5249d3
Commit
6f5249d3
authored
Mar 02, 2017
by
Diana Huang
Committed by
Brian Jacobel
Mar 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beginning of python unit tests.
parent
55905759
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
104 additions
and
67 deletions
+104
-67
lms/djangoapps/ccx/tests/test_field_override_performance.py
+27
-27
lms/djangoapps/courseware/static_tab.html
+0
-33
lms/djangoapps/courseware/tests/test_course_outline_views.py
+72
-0
lms/djangoapps/courseware/tests/test_views.py
+3
-3
lms/djangoapps/courseware/views/views.py
+2
-2
requirements/edx/base.txt
+0
-2
No files found.
lms/djangoapps/ccx/tests/test_field_override_performance.py
View file @
6f5249d3
...
@@ -231,18 +231,18 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
...
@@ -231,18 +231,18 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):
# # of sql queries to default,
# # of sql queries to default,
# # of mongo queries,
# # of mongo queries,
# )
# )
(
'no_overrides'
,
1
,
True
,
False
):
(
2
1
,
6
),
(
'no_overrides'
,
1
,
True
,
False
):
(
2
2
,
6
),
(
'no_overrides'
,
2
,
True
,
False
):
(
2
1
,
6
),
(
'no_overrides'
,
2
,
True
,
False
):
(
2
2
,
6
),
(
'no_overrides'
,
3
,
True
,
False
):
(
2
1
,
6
),
(
'no_overrides'
,
3
,
True
,
False
):
(
2
2
,
6
),
(
'ccx'
,
1
,
True
,
False
):
(
2
1
,
6
),
(
'ccx'
,
1
,
True
,
False
):
(
2
2
,
6
),
(
'ccx'
,
2
,
True
,
False
):
(
2
1
,
6
),
(
'ccx'
,
2
,
True
,
False
):
(
2
2
,
6
),
(
'ccx'
,
3
,
True
,
False
):
(
2
1
,
6
),
(
'ccx'
,
3
,
True
,
False
):
(
2
2
,
6
),
(
'no_overrides'
,
1
,
False
,
False
):
(
2
1
,
6
),
(
'no_overrides'
,
1
,
False
,
False
):
(
2
2
,
6
),
(
'no_overrides'
,
2
,
False
,
False
):
(
2
1
,
6
),
(
'no_overrides'
,
2
,
False
,
False
):
(
2
2
,
6
),
(
'no_overrides'
,
3
,
False
,
False
):
(
2
1
,
6
),
(
'no_overrides'
,
3
,
False
,
False
):
(
2
2
,
6
),
(
'ccx'
,
1
,
False
,
False
):
(
2
1
,
6
),
(
'ccx'
,
1
,
False
,
False
):
(
2
2
,
6
),
(
'ccx'
,
2
,
False
,
False
):
(
2
1
,
6
),
(
'ccx'
,
2
,
False
,
False
):
(
2
2
,
6
),
(
'ccx'
,
3
,
False
,
False
):
(
2
1
,
6
),
(
'ccx'
,
3
,
False
,
False
):
(
2
2
,
6
),
}
}
...
@@ -254,19 +254,19 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
...
@@ -254,19 +254,19 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
__test__
=
True
__test__
=
True
TEST_DATA
=
{
TEST_DATA
=
{
(
'no_overrides'
,
1
,
True
,
False
):
(
2
1
,
3
),
(
'no_overrides'
,
1
,
True
,
False
):
(
2
2
,
3
),
(
'no_overrides'
,
2
,
True
,
False
):
(
2
1
,
3
),
(
'no_overrides'
,
2
,
True
,
False
):
(
2
2
,
3
),
(
'no_overrides'
,
3
,
True
,
False
):
(
2
1
,
3
),
(
'no_overrides'
,
3
,
True
,
False
):
(
2
2
,
3
),
(
'ccx'
,
1
,
True
,
False
):
(
2
1
,
3
),
(
'ccx'
,
1
,
True
,
False
):
(
2
2
,
3
),
(
'ccx'
,
2
,
True
,
False
):
(
2
1
,
3
),
(
'ccx'
,
2
,
True
,
False
):
(
2
2
,
3
),
(
'ccx'
,
3
,
True
,
False
):
(
2
1
,
3
),
(
'ccx'
,
3
,
True
,
False
):
(
2
2
,
3
),
(
'ccx'
,
1
,
True
,
True
):
(
2
2
,
3
),
(
'ccx'
,
1
,
True
,
True
):
(
2
3
,
3
),
(
'ccx'
,
2
,
True
,
True
):
(
2
2
,
3
),
(
'ccx'
,
2
,
True
,
True
):
(
2
3
,
3
),
(
'ccx'
,
3
,
True
,
True
):
(
2
2
,
3
),
(
'ccx'
,
3
,
True
,
True
):
(
2
3
,
3
),
(
'no_overrides'
,
1
,
False
,
False
):
(
2
1
,
3
),
(
'no_overrides'
,
1
,
False
,
False
):
(
2
2
,
3
),
(
'no_overrides'
,
2
,
False
,
False
):
(
2
1
,
3
),
(
'no_overrides'
,
2
,
False
,
False
):
(
2
2
,
3
),
(
'no_overrides'
,
3
,
False
,
False
):
(
2
1
,
3
),
(
'no_overrides'
,
3
,
False
,
False
):
(
2
2
,
3
),
(
'ccx'
,
1
,
False
,
False
):
(
2
1
,
3
),
(
'ccx'
,
1
,
False
,
False
):
(
2
2
,
3
),
(
'ccx'
,
2
,
False
,
False
):
(
2
1
,
3
),
(
'ccx'
,
2
,
False
,
False
):
(
2
2
,
3
),
(
'ccx'
,
3
,
False
,
False
):
(
2
1
,
3
),
(
'ccx'
,
3
,
False
,
False
):
(
2
2
,
3
),
}
}
lms/djangoapps/courseware/static_tab.html
deleted
100644 → 0
View file @
55905759
## mako
<
%
page
expression_filter=
"h"
/>
<
%!
from
openedx
.
core
.
djangolib
.
markup
import
HTML
%
>
<
%
inherit
file=
"/main.html"
/>
<
%
block
name=
"bodyclass"
>
view-in-course view-statictab ${course.css_class or ''}
</
%
block>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'style-course-vendor'
/>
<
%
static:css
group=
'style-course'
/>
${HTML(fragment.head_html())}
</
%
block>
<
%
block
name=
"js_extra"
>
<
%
include
file=
"/mathjax_include.html"
args=
"disable_fast_preview=True"
/>
${HTML(fragment.foot_html())}
</
%
block>
<
%
block
name=
"pagetitle"
>
${tab['name']} | ${course.display_number_with_default}
</
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page=active_page"
/>
<main
id=
"main"
aria-label=
"Content"
tabindex=
"-1"
>
<section
class=
"container"
>
<div
class=
"static_tab_wrapper"
>
${HTML(fragment.body_html())}
</div>
</section>
</main>
lms/djangoapps/courseware/tests/test_course_outline_views.py
0 → 100644
View file @
6f5249d3
"""
Tests for the Course Outline view and supporting views.
"""
from
django.core.urlresolvers
import
reverse
from
student.models
import
CourseEnrollment
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
class
TestCourseOutlinePage
(
SharedModuleStoreTestCase
):
"""
Test the new course outline view.
"""
@classmethod
def
setUpClass
(
cls
):
"""Set up the simplest course possible."""
# setUpClassAndTestData() already calls setUpClass on SharedModuleStoreTestCase
# pylint: disable=super-method-not-called
with
super
(
TestCourseOutlinePage
,
cls
)
.
setUpClassAndTestData
():
cls
.
courses
=
[]
course
=
CourseFactory
.
create
()
with
cls
.
store
.
bulk_operations
(
course
.
id
):
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
parent_location
=
course
.
location
)
section
=
ItemFactory
.
create
(
category
=
'sequential'
,
parent_location
=
chapter
.
location
)
ItemFactory
.
create
(
category
=
'vertical'
,
parent_location
=
section
.
location
)
cls
.
courses
.
append
(
course
)
course
=
CourseFactory
.
create
()
with
cls
.
store
.
bulk_operations
(
course
.
id
):
chapter
=
ItemFactory
.
create
(
category
=
'chapter'
,
parent_location
=
course
.
location
)
section
=
ItemFactory
.
create
(
category
=
'sequential'
,
parent_location
=
chapter
.
location
)
section2
=
ItemFactory
.
create
(
category
=
'sequential'
,
parent_location
=
chapter
.
location
)
ItemFactory
.
create
(
category
=
'vertical'
,
parent_location
=
section
.
location
)
ItemFactory
.
create
(
category
=
'vertical'
,
parent_location
=
section2
.
location
)
@classmethod
def
setUpTestData
(
cls
):
"""Set up and enroll our fake user in the course."""
cls
.
password
=
'test'
cls
.
user
=
UserFactory
(
password
=
cls
.
password
)
for
course
in
cls
.
courses
:
CourseEnrollment
.
enroll
(
cls
.
user
,
course
.
id
)
def
setUp
(
self
):
"""
Set up for the tests.
"""
super
(
TestCourseOutlinePage
,
self
)
.
setUp
()
self
.
client
.
login
(
username
=
self
.
user
.
username
,
password
=
self
.
password
)
def
test_render
(
self
):
for
course
in
self
.
courses
:
url
=
reverse
(
'unified_course_view'
,
kwargs
=
{
'course_id'
:
unicode
(
course
.
id
),
}
)
response
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
response
.
status_code
,
200
)
response_content
=
response
.
content
.
decode
(
"utf-8"
)
for
chapter
in
course
.
children
:
self
.
assertIn
(
chapter
.
display_name
,
response_content
)
for
section
in
chapter
.
children
:
self
.
assertIn
(
section
.
display_name
,
response_content
)
for
vertical
in
section
.
children
:
self
.
assertNotIn
(
vertical
.
display_name
,
response_content
)
lms/djangoapps/courseware/tests/test_views.py
View file @
6f5249d3
...
@@ -1419,17 +1419,17 @@ class ProgressPageTests(ModuleStoreTestCase):
...
@@ -1419,17 +1419,17 @@ class ProgressPageTests(ModuleStoreTestCase):
"""Test that query counts remain the same for self-paced and instructor-paced courses."""
"""Test that query counts remain the same for self-paced and instructor-paced courses."""
SelfPacedConfiguration
(
enabled
=
self_paced_enabled
)
.
save
()
SelfPacedConfiguration
(
enabled
=
self_paced_enabled
)
.
save
()
self
.
setup_course
(
self_paced
=
self_paced
)
self
.
setup_course
(
self_paced
=
self_paced
)
with
self
.
assertNumQueries
(
3
8
),
check_mongo_calls
(
4
):
with
self
.
assertNumQueries
(
3
9
),
check_mongo_calls
(
4
):
self
.
_get_progress_page
()
self
.
_get_progress_page
()
def
test_progress_queries
(
self
):
def
test_progress_queries
(
self
):
self
.
setup_course
()
self
.
setup_course
()
with
self
.
assertNumQueries
(
3
8
),
check_mongo_calls
(
4
):
with
self
.
assertNumQueries
(
3
9
),
check_mongo_calls
(
4
):
self
.
_get_progress_page
()
self
.
_get_progress_page
()
# subsequent accesses to the progress page require fewer queries.
# subsequent accesses to the progress page require fewer queries.
for
_
in
range
(
2
):
for
_
in
range
(
2
):
with
self
.
assertNumQueries
(
2
4
),
check_mongo_calls
(
4
):
with
self
.
assertNumQueries
(
2
5
),
check_mongo_calls
(
4
):
self
.
_get_progress_page
()
self
.
_get_progress_page
()
@patch
(
@patch
(
...
...
lms/djangoapps/courseware/views/views.py
View file @
6f5249d3
...
@@ -1647,7 +1647,7 @@ class UnifiedCourseView(View):
...
@@ -1647,7 +1647,7 @@ class UnifiedCourseView(View):
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_key
,
check_if_enrolled
=
True
)
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_key
,
check_if_enrolled
=
True
)
# Render the outline as a fragment
# Render the outline as a fragment
outline_fragment
=
CourseOutlineFragmentView
()
.
render_fragment
(
request
,
course_id
=
course_id
)
outline_fragment
=
CourseOutlineFragmentView
()
.
render_
to_
fragment
(
request
,
course_id
=
course_id
)
# Render the entire unified course view
# Render the entire unified course view
context
=
{
context
=
{
...
@@ -1680,7 +1680,7 @@ class CourseOutlineFragmentView(FragmentView):
...
@@ -1680,7 +1680,7 @@ class CourseOutlineFragmentView(FragmentView):
return
block
return
block
def
render_fragment
(
self
,
request
,
course_id
=
None
,
**
kwargs
):
def
render_
to_
fragment
(
self
,
request
,
course_id
=
None
,
**
kwargs
):
"""
"""
Renders the course outline as a fragment.
Renders the course outline as a fragment.
"""
"""
...
...
requirements/edx/base.txt
View file @
6f5249d3
...
@@ -111,9 +111,7 @@ django-ratelimit-backend==1.0
...
@@ -111,9 +111,7 @@ django-ratelimit-backend==1.0
unicodecsv==0.9.4
unicodecsv==0.9.4
django-require==1.0.11
django-require==1.0.11
pyuca==1.1
pyuca==1.1
web-fragments==0.1.0
wrapt==1.10.5
wrapt==1.10.5
XBlock==0.4.14
zendesk==1.1.1
zendesk==1.1.1
# This needs to be installed *after* Cython, which is in pre.txt
# This needs to be installed *after* Cython, which is in pre.txt
...
...
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