'Tests if get_html is wrapped when feature flag is on and edxnotes are
enabled for the course.'

@patch.dict('django.conf.settings.FEATURES', {'ENABLE_EDXNOTES': True})
@patch('edxnotes.decorators.get_public_endpoint', autospec=True)
@patch('edxnotes.decorators.get_token_url', autospec=True)
@patch('edxnotes.decorators.get_edxnotes_id_token', autospec=True)
@patch('edxnotes.decorators.generate_uid', autospec=True)
def test_edxnotes_enabled(self, mock_generate_uid, mock_get_id_token, mock_get_token_url, mock_get_endpoint):

    mock_generate_uid.return_value = 'uid'
    mock_get_id_token.return_value = 'token'
    mock_get_token_url.return_value = '/tokenUrl'
    mock_get_endpoint.return_value = '/endpoint'
    enable_edxnotes_for_the_course(self.course, self.user.id)
    expected_context = {'content': 'original_get_html', 'uid': 'uid', 'edxnotes_visibility': 'true', 'params': {'usageId': u'test_usage_id', 'courseId': unicode(self.course.id).encode('utf-8'), 'token': 'token', 'tokenUrl': '/tokenUrl', 'endpoint': '/endpoint', 'debug': settings.DEBUG, 'eventStringLimit': (settings.TRACK_MAX_EVENT / 6)}}
    self.assertEqual(self.problem.get_html(), render_to_string('edxnotes_wrapper.html', expected_context))
