From 0dc180ddc3fdce903a494bdbf3c6b5937fb29276 Mon Sep 17 00:00:00 2001 From: Ayub khan Date: Tue, 3 Sep 2019 13:45:15 +0500 Subject: [PATCH] BOM-398 py3 combatibility - test fix --- cms/djangoapps/contentstore/views/tests/test_tabs.py | 2 +- common/lib/xmodule/xmodule/tabs.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_tabs.py b/cms/djangoapps/contentstore/views/tests/test_tabs.py index 343d12653a..9452d97db3 100644 --- a/cms/djangoapps/contentstore/views/tests/test_tabs.py +++ b/cms/djangoapps/contentstore/views/tests/test_tabs.py @@ -71,7 +71,7 @@ class TabsPageTests(CourseTestCase): resp = self.client.get_html(self.url) self.assertEqual(resp.status_code, 200) - self.assertIn('course-nav-list', resp.content) + self.assertIn('course-nav-list', resp.content.decode('utf-8')) def test_reorder_tabs(self): """Test re-ordering of tabs""" diff --git a/common/lib/xmodule/xmodule/tabs.py b/common/lib/xmodule/xmodule/tabs.py index 253e6d640b..18f9166dd0 100644 --- a/common/lib/xmodule/xmodule/tabs.py +++ b/common/lib/xmodule/xmodule/tabs.py @@ -172,6 +172,10 @@ class CourseTab(six.with_metaclass(ABCMeta, object)): """ return not self == other + def __hash__(self): + """ Return a hash representation of Tab Object. """ + return hash(repr(self)) + @classmethod def validate(cls, tab_dict, raise_error=True): """ @@ -294,6 +298,10 @@ class TabFragmentViewMixin(object): """ return self.fragment_view.render_to_fragment(request, course_id=six.text_type(course.id), **kwargs) + def __hash__(self): + """ Return a hash representation of Tab Object. """ + return hash(repr(self)) + class StaticTab(CourseTab): """ @@ -359,6 +367,10 @@ class StaticTab(CourseTab): return False return self.url_slug == other.get('url_slug') + def __hash__(self): + """ Return a hash representation of Tab Object. """ + return hash(repr(self)) + class CourseTabList(List): """