diff --git a/cms/djangoapps/contentstore/views/tests/test_container.py b/cms/djangoapps/contentstore/views/tests/test_container.py
index dbc0aae23a..30966b124f 100644
--- a/cms/djangoapps/contentstore/views/tests/test_container.py
+++ b/cms/djangoapps/contentstore/views/tests/test_container.py
@@ -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)
diff --git a/cms/djangoapps/contentstore/views/tests/test_tabs.py b/cms/djangoapps/contentstore/views/tests/test_tabs.py
index 63396884f1..ad17fd8365 100644
--- a/cms/djangoapps/contentstore/views/tests/test_tabs.py
+++ b/cms/djangoapps/contentstore/views/tests/test_tabs.py
@@ -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)
diff --git a/common/djangoapps/external_auth/tests/test_ssl.py b/common/djangoapps/external_auth/tests/test_ssl.py
index 7fb1c6a9d7..5445e5286e 100644
--- a/common/djangoapps/external_auth/tests/test_ssl.py
+++ b/common/djangoapps/external_auth/tests/test_ssl.py
@@ -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)
diff --git a/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py b/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
index c343bded18..244d4a2da5 100644
--- a/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+++ b/common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
@@ -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 www.lolcatz.com'
+ 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