'Tests that edxnotes tab is shown only when the feature is enabled.'

def test_edxnotes_tab(self):

    def has_notes_tab(user, course):
        'Returns    true    if    the    "Notes"    tab    is    shown.'
        request = RequestFactory().request()
        request.user = user
        tabs = get_course_tab_list(request, course)
        return (len([tab for tab in tabs if (tab.type == 'edxnotes')]) == 1)
    self.assertFalse(has_notes_tab(self.user, self.course))
    enable_edxnotes_for_the_course(self.course, self.user.id)
    self.course.edxnotes = False
    self.assertFalse(has_notes_tab(self.user, self.course))
    self.course.edxnotes = True
    self.assertTrue(has_notes_tab(self.user, self.course))
