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
a4df0e15
Commit
a4df0e15
authored
May 12, 2014
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing tests
parent
85ca7db7
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
43 additions
and
24 deletions
+43
-24
cms/djangoapps/contentstore/views/tests/test_container.py
+1
-1
cms/djangoapps/contentstore/views/tests/test_tabs.py
+2
-2
common/djangoapps/external_auth/tests/test_ssl.py
+2
-4
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+30
-8
common/lib/xmodule/xmodule/tests/test_lti20_unit.py
+4
-5
lms/djangoapps/courseware/tests/test_lti_integration.py
+1
-1
lms/djangoapps/dashboard/sysadmin.py
+1
-1
lms/djangoapps/instructor/tests/test_legacy_email.py
+2
-2
No files found.
cms/djangoapps/contentstore/views/tests/test_container.py
View file @
a4df0e15
...
...
@@ -128,7 +128,7 @@ class ContainerViewTestCase(CourseTestCase):
"""
Verify that the specified xblock has the expected HTML elements for container preview
"""
locator
=
loc_mapper
()
.
translate_location
(
self
.
course
.
id
,
xblock
.
location
,
published
=
False
)
locator
=
loc_mapper
()
.
translate_location
(
xblock
.
location
,
published
=
False
)
publish_state
=
compute_publish_state
(
xblock
)
preview_url
=
'/xblock/{locator}/container_preview'
.
format
(
locator
=
locator
)
...
...
cms/djangoapps/contentstore/views/tests/test_tabs.py
View file @
a4df0e15
...
...
@@ -178,8 +178,8 @@ class TabsPageTests(CourseTestCase):
"""
Verify that the static tab renders itself with the correct HTML
"""
locator
=
loc_mapper
()
.
translate_location
(
self
.
course
.
id
,
self
.
test_tab
.
location
)
preview_url
=
'/xblock/{locator}/student_view'
.
format
(
locator
=
locator
)
locator
=
loc_mapper
()
.
translate_location
(
self
.
test_tab
.
location
)
preview_url
=
'/xblock/{locator}/student_view'
.
format
(
locator
=
unicode
(
locator
)
)
resp
=
self
.
client
.
get
(
preview_url
,
HTTP_ACCEPT
=
'application/json'
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
...
...
common/djangoapps/external_auth/tests/test_ssl.py
View file @
a4df0e15
...
...
@@ -381,11 +381,9 @@ class SSLClientTest(ModuleStoreTestCase):
user
=
User
.
objects
.
get
(
email
=
self
.
USER_EMAIL
)
CourseEnrollment
.
enroll
(
user
,
course
.
id
)
CourseStaffRole
(
course
.
location
)
.
add_users
(
user
)
location
=
Location
([
'i4x'
,
'MITx'
,
'999'
,
'course'
,
Location
.
clean
(
'Robot Super Course'
),
None
])
CourseStaffRole
(
course
.
id
)
.
add_users
(
user
)
new_location
=
loc_mapper
()
.
translate_location
(
location
.
course_id
,
location
,
True
,
True
course
.
location
,
True
,
True
)
course_private_url
=
new_location
.
url_reverse
(
'course/'
,
''
)
self
.
assertFalse
(
SESSION_KEY
in
self
.
client
.
session
)
...
...
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
a4df0e15
...
...
@@ -12,6 +12,7 @@ import unittest
from
datetime
import
datetime
from
lxml
import
etree
from
lxml.html
import
fragment_fromstring
from
mock
import
Mock
,
MagicMock
,
patch
from
pytz
import
UTC
from
webob.multidict
import
MultiDict
...
...
@@ -1384,23 +1385,44 @@ class OpenEndedModuleUtilTest(unittest.TestCase):
link_text
=
u'I love going to www.lolcatz.com'
link_atag
=
u'I love going to <a target="_blank" href="http://www.lolcatz.com">www.lolcatz.com</a>'
def
assertHtmlEqual
(
self
,
actual
,
expected
):
"""
Assert that two strings represent the same html.
"""
return
self
.
_assertHtmlEqual
(
fragment_fromstring
(
actual
,
create_parent
=
'div'
),
fragment_fromstring
(
expected
,
create_parent
=
'div'
)
)
def
_assertHtmlEqual
(
self
,
actual
,
expected
):
"""
Assert that two HTML ElementTree elements are equal.
"""
self
.
assertEqual
(
actual
.
tag
,
expected
.
tag
)
self
.
assertEqual
(
actual
.
attrib
,
expected
.
attrib
)
self
.
assertEqual
(
actual
.
text
,
expected
.
text
)
self
.
assertEqual
(
actual
.
tail
,
expected
.
tail
)
self
.
assertEqual
(
len
(
actual
),
len
(
expected
))
for
actual_child
,
expected_child
in
zip
(
actual
,
expected
):
self
.
_assertHtmlEqual
(
actual_child
,
expected_child
)
def
test_script
(
self
):
"""
Basic test for stripping <script>
"""
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
self
.
script_dirty
),
self
.
script_clean
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
self
.
script_dirty
),
self
.
script_clean
)
def
test_img
(
self
):
"""
Basic test for passing through img, but stripping bad attr
"""
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
self
.
img_dirty
),
self
.
img_clean
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
self
.
img_dirty
),
self
.
img_clean
)
def
test_embed
(
self
):
"""
Basic test for passing through embed, but stripping bad attr
"""
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
self
.
embed_dirty
),
self
.
embed_clean
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
self
.
embed_dirty
),
self
.
embed_clean
)
def
test_iframe
(
self
):
"""
...
...
@@ -1412,25 +1434,25 @@ class OpenEndedModuleUtilTest(unittest.TestCase):
"""
Test for passing through text unchanged, including unicode
"""
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
self
.
text
),
self
.
text
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
self
.
text
),
self
.
text
)
def
test_lessthan
(
self
):
"""
Tests that `<` in text context is handled properly
"""
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
self
.
text_lessthan_noencd
),
self
.
text_lessthan_encode
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
self
.
text_lessthan_noencd
),
self
.
text_lessthan_encode
)
def
test_linebreaks
(
self
):
"""
tests the replace_newlines function
"""
self
.
assertEqual
(
OpenEndedChild
.
replace_newlines
(
self
.
text_linebreaks
),
self
.
text_brs
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
replace_newlines
(
self
.
text_linebreaks
),
self
.
text_brs
)
def
test_linkify
(
self
):
"""
tests the replace_newlines function
"""
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
self
.
link_text
),
self
.
link_atag
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
self
.
link_text
),
self
.
link_atag
)
def
test_combined
(
self
):
"""
...
...
@@ -1448,4 +1470,4 @@ class OpenEndedModuleUtilTest(unittest.TestCase):
self
.
embed_clean
,
self
.
text_lessthan_encode
,
self
.
img_clean
)
self
.
assertEqual
(
OpenEndedChild
.
sanitize_html
(
test_input
),
test_output
)
self
.
assert
Html
Equal
(
OpenEndedChild
.
sanitize_html
(
test_input
),
test_output
)
common/lib/xmodule/xmodule/tests/test_lti20_unit.py
View file @
a4df0e15
...
...
@@ -25,13 +25,12 @@ class LTI20RESTResultServiceTest(LogicTest):
def
test_sanitize_get_context
(
self
):
"""Tests that the get_context function does basic sanitization"""
# get_context, unfortunately, requires a lot of mocking machinery
mocked_course
=
Mock
(
lti_passports
=
[
'lti_id:test_client:test_secret'
])
modulestore
=
Mock
()
modulestore
.
get_
item
.
return_value
=
mocked_course
runtime
=
Mock
(
modulestore
=
modulestore
)
mocked_course
=
Mock
(
name
=
'mocked_course'
,
lti_passports
=
[
'lti_id:test_client:test_secret'
])
modulestore
=
Mock
(
name
=
'modulestore'
)
modulestore
.
get_
course
.
return_value
=
mocked_course
runtime
=
Mock
(
name
=
'runtime'
,
modulestore
=
modulestore
)
self
.
xmodule
.
descriptor
.
runtime
=
runtime
self
.
xmodule
.
lti_id
=
"lti_id"
self
.
xmodule
.
scope_ids
.
usage_id
=
"mocked"
test_cases
=
(
# (before sanitize, after sanitize)
(
u"plaintext"
,
u"plaintext"
),
...
...
lms/djangoapps/courseware/tests/test_lti_integration.py
View file @
a4df0e15
...
...
@@ -168,7 +168,7 @@ class TestLTIModuleListing(ModuleStoreTestCase):
'courseware.module_render.handle_xblock_callback_noauth'
,
args
=
[
self
.
course
.
id
.
to_deprecated_string
(),
quote_slashes
(
unicode
(
self
.
lti_published
.
scope_ids
.
usage_id
)
.
encode
(
'utf-8'
)),
quote_slashes
(
unicode
(
self
.
lti_published
.
scope_ids
.
usage_id
.
to_deprecated_string
()
)
.
encode
(
'utf-8'
)),
handler
]
))
...
...
lms/djangoapps/dashboard/sysadmin.py
View file @
a4df0e15
...
...
@@ -573,7 +573,7 @@ class Courses(SysadminDashboardView):
# don't delete user permission groups, though
self
.
msg
+=
\
u"<font color='red'>{0} {1} = {2} ({3})</font>"
.
format
(
_
(
'Deleted'
),
loc
,
course
.
id
.
to_deprecated_string
(),
course
.
display_name
)
_
(
'Deleted'
),
course
.
location
.
to_deprecated_string
()
,
course
.
id
.
to_deprecated_string
(),
course
.
display_name
)
context
=
{
'datatable'
:
self
.
make_datatable
(),
...
...
lms/djangoapps/instructor/tests/test_legacy_email.py
View file @
a4df0e15
...
...
@@ -50,7 +50,7 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase):
# Select the Email view of the instructor dash
session
=
self
.
client
.
session
session
[
u'idash_mode:{0}'
.
format
(
self
.
course
.
location
.
course_key
)]
=
'Email'
session
[
u'idash_mode:{0}'
.
format
(
self
.
course
.
location
.
course_key
.
to_deprecated_string
()
)]
=
'Email'
session
.
save
()
response
=
self
.
client
.
get
(
self
.
url
)
...
...
@@ -131,7 +131,7 @@ class TestInstructorDashboardEmailView(ModuleStoreTestCase):
course_authorization
.
save
()
session
=
self
.
client
.
session
session
[
u'idash_mode:{0}'
.
format
(
self
.
course
.
location
.
course_key
)]
=
'Email'
session
[
u'idash_mode:{0}'
.
format
(
self
.
course
.
location
.
course_key
.
to_deprecated_string
()
)]
=
'Email'
session
.
save
()
response
=
self
.
client
.
post
(
...
...
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